Browse Source

misc: Migrations in module

tags/v0.1.0.1
Dale 2 months ago
parent
commit
493c801426
4 changed files with 16 additions and 6 deletions
  1. +6
    -6
      default.nix
  2. +6
    -0
      module.nix
  3. +3
    -0
      src/server/config.ts
  4. +1
    -0
      src/server/db/index.ts

+ 6
- 6
default.nix View File

@@ -3,12 +3,12 @@ with import <nixpkgs> {};
let
executableName = "miracle-tv-server";
version = "0.1.0";
src = fetchgit {
url = "https://code.gensokyo.social/Gensokyo.social/miracle-tv.git";
rev = "5dc4e5825461d1d132e57a941a3270e4cdfe6e9c";
sha256 = "13nm2v1256aqfxcpaxqz4f7dmiww4in7xqnhwg2l91y25kp7mj23";
};
# src = ./.;
# src = fetchgit {
# url = "https://code.gensokyo.social/Gensokyo.social/miracle-tv.git";
# rev = "5dc4e5825461d1d132e57a941a3270e4cdfe6e9c";
# sha256 = "13nm2v1256aqfxcpaxqz4f7dmiww4in7xqnhwg2l91y25kp7mj23";
# };
src = ./.;
nodePkg = pkgs.nodejs-14_x;
yarnPkg = pkgs.yarn.override { nodejs = nodePkg; };
in mkYarnPackage rec {


+ 6
- 0
module.nix View File

@@ -36,6 +36,12 @@ in {
default = "";
};
};
migrations = {
directory = mkOption {
type = types.str;
default = "${miracle-tv}/migrations";
};
};
};
server = {
port = mkOption {


+ 3
- 0
src/server/config.ts View File

@@ -11,6 +11,9 @@ interface IDBConfig {
database?: string,
filename?: string,
};
migrations: {
directory: string,
};
}

interface IServerConfig {


+ 1
- 0
src/server/db/index.ts View File

@@ -3,6 +3,7 @@ import Knex from 'knex';
import config from 'server/config';

const knex = Knex(config.database);
console.log(__dirname);
knex.migrate.latest();

export default knex;

Loading…
Cancel
Save