@takaro/db 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/migrations/sql/20250305210650-more-module-metadata.d.ts +4 -0
  2. package/dist/migrations/sql/20250305210650-more-module-metadata.d.ts.map +1 -0
  3. package/dist/migrations/sql/20250305210650-more-module-metadata.js +37 -0
  4. package/dist/migrations/sql/20250305210650-more-module-metadata.js.map +1 -0
  5. package/dist/migrations/sql/20250307162855-default-systemconfig.d.ts +4 -0
  6. package/dist/migrations/sql/20250307162855-default-systemconfig.d.ts.map +1 -0
  7. package/dist/migrations/sql/20250307162855-default-systemconfig.js +11 -0
  8. package/dist/migrations/sql/20250307162855-default-systemconfig.js.map +1 -0
  9. package/dist/migrations/sql/20250312184104-unique-external-reference.d.ts +4 -0
  10. package/dist/migrations/sql/20250312184104-unique-external-reference.d.ts.map +1 -0
  11. package/dist/migrations/sql/20250312184104-unique-external-reference.js +11 -0
  12. package/dist/migrations/sql/20250312184104-unique-external-reference.js.map +1 -0
  13. package/dist/migrations/sql/20250314185501-root-users-not-dashboard-user.d.ts +4 -0
  14. package/dist/migrations/sql/20250314185501-root-users-not-dashboard-user.d.ts.map +1 -0
  15. package/dist/migrations/sql/20250314185501-root-users-not-dashboard-user.js +15 -0
  16. package/dist/migrations/sql/20250314185501-root-users-not-dashboard-user.js.map +1 -0
  17. package/dist/migrations/sql/20250315191707-fix-constraint-module-items.d.ts +8 -0
  18. package/dist/migrations/sql/20250315191707-fix-constraint-module-items.d.ts.map +1 -0
  19. package/dist/migrations/sql/20250315191707-fix-constraint-module-items.js +17 -0
  20. package/dist/migrations/sql/20250315191707-fix-constraint-module-items.js.map +1 -0
  21. package/package.json +2 -10
  22. package/src/migrations/sql/20250305210650-more-module-metadata.ts +49 -0
  23. package/src/migrations/sql/20250307162855-default-systemconfig.ts +13 -0
  24. package/src/migrations/sql/20250312184104-unique-external-reference.ts +13 -0
  25. package/src/migrations/sql/20250314185501-root-users-not-dashboard-user.ts +17 -0
  26. package/src/migrations/sql/20250315191707-fix-constraint-module-items.ts +26 -0
@@ -0,0 +1,4 @@
1
+ import { Knex } from 'knex';
2
+ export declare function up(knex: Knex): Promise<void>;
3
+ export declare function down(knex: Knex): Promise<void>;
4
+ //# sourceMappingURL=20250305210650-more-module-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20250305210650-more-module-metadata.d.ts","sourceRoot":"","sources":["../../../src/migrations/sql/20250305210650-more-module-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,wBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBlD;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBpD"}
@@ -0,0 +1,37 @@
1
+ export async function up(knex) {
2
+ await knex.schema.alterTable('hooks', (table) => {
3
+ table.text('description').nullable();
4
+ });
5
+ await knex.schema.alterTable('commands', (table) => {
6
+ table.text('description').nullable();
7
+ });
8
+ await knex.schema.alterTable('cronJobs', (table) => {
9
+ table.text('description').nullable();
10
+ });
11
+ await knex.schema.alterTable('functions', (table) => {
12
+ table.text('description').nullable();
13
+ });
14
+ await knex.raw('ALTER TABLE hooks ADD CONSTRAINT description_length_check CHECK (length(description) <= 131072)');
15
+ await knex.raw('ALTER TABLE commands ADD CONSTRAINT description_length_check CHECK (length(description) <= 131072)');
16
+ await knex.raw('ALTER TABLE "cronJobs" ADD CONSTRAINT description_length_check CHECK (length(description) <= 131072)');
17
+ await knex.raw('ALTER TABLE functions ADD CONSTRAINT description_length_check CHECK (length(description) <= 131072)');
18
+ }
19
+ export async function down(knex) {
20
+ await knex.raw('ALTER TABLE hooks DROP CONSTRAINT description_length_check');
21
+ await knex.raw('ALTER TABLE commands DROP CONSTRAINT description_length_check');
22
+ await knex.raw('ALTER TABLE "cronJobs" DROP CONSTRAINT description_length_check');
23
+ await knex.raw('ALTER TABLE functions DROP CONSTRAINT description_length_check');
24
+ await knex.schema.alterTable('hooks', (table) => {
25
+ table.dropColumn('description');
26
+ });
27
+ await knex.schema.alterTable('commands', (table) => {
28
+ table.dropColumn('description');
29
+ });
30
+ await knex.schema.alterTable('cronJobs', (table) => {
31
+ table.dropColumn('description');
32
+ });
33
+ await knex.schema.alterTable('functions', (table) => {
34
+ table.dropColumn('description');
35
+ });
36
+ }
37
+ //# sourceMappingURL=20250305210650-more-module-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20250305210650-more-module-metadata.js","sourceRoot":"","sources":["../../../src/migrations/sql/20250305210650-more-module-metadata.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QAC9C,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE;QACjD,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE;QACjD,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;QAClD,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,GAAG,CAAC,iGAAiG,CAAC,CAAC;IAClH,MAAM,IAAI,CAAC,GAAG,CAAC,oGAAoG,CAAC,CAAC;IACrH,MAAM,IAAI,CAAC,GAAG,CACZ,sGAAsG,CACvG,CAAC;IACF,MAAM,IAAI,CAAC,GAAG,CAAC,qGAAqG,CAAC,CAAC;AACxH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAU;IACnC,MAAM,IAAI,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;IAC7E,MAAM,IAAI,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;IAChF,MAAM,IAAI,CAAC,GAAG,CAAC,iEAAiE,CAAC,CAAC;IAClF,MAAM,IAAI,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC;IAEjF,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QAC9C,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE;QACjD,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE;QACjD,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;QAClD,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Knex } from 'knex';
2
+ export declare function up(knex: Knex): Promise<void>;
3
+ export declare function down(knex: Knex): Promise<void>;
4
+ //# sourceMappingURL=20250307162855-default-systemconfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20250307162855-default-systemconfig.d.ts","sourceRoot":"","sources":["../../../src/migrations/sql/20250307162855-default-systemconfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,wBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAIlD;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAIpD"}
@@ -0,0 +1,11 @@
1
+ export async function up(knex) {
2
+ await knex.schema.alterTable('moduleVersions', (table) => {
3
+ table.jsonb('defaultSystemConfig').nullable();
4
+ });
5
+ }
6
+ export async function down(knex) {
7
+ await knex.schema.alterTable('moduleVersions', (table) => {
8
+ table.dropColumn('defaultSystemConfig');
9
+ });
10
+ }
11
+ //# sourceMappingURL=20250307162855-default-systemconfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20250307162855-default-systemconfig.js","sourceRoot":"","sources":["../../../src/migrations/sql/20250307162855-default-systemconfig.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,EAAE;QACvD,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,QAAQ,EAAE,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAU;IACnC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,EAAE;QACvD,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Knex } from 'knex';
2
+ export declare function up(knex: Knex): Promise<void>;
3
+ export declare function down(knex: Knex): Promise<void>;
4
+ //# sourceMappingURL=20250312184104-unique-external-reference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20250312184104-unique-external-reference.d.ts","sourceRoot":"","sources":["../../../src/migrations/sql/20250312184104-unique-external-reference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,wBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAIlD;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAIpD"}
@@ -0,0 +1,11 @@
1
+ export async function up(knex) {
2
+ await knex.schema.alterTable('domains', (table) => {
3
+ table.unique(['externalReference']);
4
+ });
5
+ }
6
+ export async function down(knex) {
7
+ await knex.schema.alterTable('domains', (table) => {
8
+ table.dropUnique(['externalReference']);
9
+ });
10
+ }
11
+ //# sourceMappingURL=20250312184104-unique-external-reference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20250312184104-unique-external-reference.js","sourceRoot":"","sources":["../../../src/migrations/sql/20250312184104-unique-external-reference.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QAChD,KAAK,CAAC,MAAM,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAU;IACnC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QAChD,KAAK,CAAC,UAAU,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Knex } from 'knex';
2
+ export declare function up(knex: Knex): Promise<void>;
3
+ export declare function down(knex: Knex): Promise<void>;
4
+ //# sourceMappingURL=20250314185501-root-users-not-dashboard-user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20250314185501-root-users-not-dashboard-user.d.ts","sourceRoot":"","sources":["../../../src/migrations/sql/20250314185501-root-users-not-dashboard-user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,wBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAMlD;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAMpD"}
@@ -0,0 +1,15 @@
1
+ export async function up(knex) {
2
+ await knex.raw(`
3
+ UPDATE users
4
+ SET "isDashboardUser" = false
5
+ WHERE name = 'root'
6
+ `);
7
+ }
8
+ export async function down(knex) {
9
+ await knex.raw(`
10
+ UPDATE users
11
+ SET "isDashboardUser" = true
12
+ WHERE name = 'root'
13
+ `);
14
+ }
15
+ //# sourceMappingURL=20250314185501-root-users-not-dashboard-user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20250314185501-root-users-not-dashboard-user.js","sourceRoot":"","sources":["../../../src/migrations/sql/20250314185501-root-users-not-dashboard-user.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,MAAM,IAAI,CAAC,GAAG,CAAC;;;;GAId,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAU;IACnC,MAAM,IAAI,CAAC,GAAG,CAAC;;;;GAId,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Knex } from 'knex';
2
+ /**
3
+ * This migration ensures that all commands,hooks,cronjobs have a unique name inside their module version
4
+ * @param knex
5
+ */
6
+ export declare function up(knex: Knex): Promise<void>;
7
+ export declare function down(knex: Knex): Promise<void>;
8
+ //# sourceMappingURL=20250315191707-fix-constraint-module-items.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20250315191707-fix-constraint-module-items.d.ts","sourceRoot":"","sources":["../../../src/migrations/sql/20250315191707-fix-constraint-module-items.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B;;;GAGG;AAEH,wBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAWlD;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAKpD"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This migration ensures that all commands,hooks,cronjobs have a unique name inside their module version
3
+ * @param knex
4
+ */
5
+ export async function up(knex) {
6
+ await knex.raw(`ALTER TABLE "commands" ADD CONSTRAINT "commands_unique_name_versionId" UNIQUE ("name", "versionId");`);
7
+ await knex.raw(`ALTER TABLE "hooks" ADD CONSTRAINT "hooks_unique_name_versionId" UNIQUE ("name", "versionId");`);
8
+ await knex.raw(`ALTER TABLE "cronJobs" ADD CONSTRAINT "cronJobs_unique_name_versionId" UNIQUE ("name", "versionId");`);
9
+ await knex.raw(`ALTER TABLE "functions" ADD CONSTRAINT "functions_unique_name_versionId" UNIQUE ("name", "versionId");`);
10
+ }
11
+ export async function down(knex) {
12
+ await knex.raw(`ALTER TABLE "commands" DROP CONSTRAINT "commands_unique_name_versionId";`);
13
+ await knex.raw(`ALTER TABLE "hooks" DROP CONSTRAINT "hooks_unique_name_versionId";`);
14
+ await knex.raw(`ALTER TABLE "cronJobs" DROP CONSTRAINT "cronJobs_unique_name_versionId";`);
15
+ await knex.raw(`ALTER TABLE "functions" DROP CONSTRAINT "functions_unique_name_versionId";`);
16
+ }
17
+ //# sourceMappingURL=20250315191707-fix-constraint-module-items.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20250315191707-fix-constraint-module-items.js","sourceRoot":"","sources":["../../../src/migrations/sql/20250315191707-fix-constraint-module-items.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,MAAM,IAAI,CAAC,GAAG,CACZ,sGAAsG,CACvG,CAAC;IACF,MAAM,IAAI,CAAC,GAAG,CAAC,gGAAgG,CAAC,CAAC;IACjH,MAAM,IAAI,CAAC,GAAG,CACZ,sGAAsG,CACvG,CAAC;IACF,MAAM,IAAI,CAAC,GAAG,CACZ,wGAAwG,CACzG,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAU;IACnC,MAAM,IAAI,CAAC,GAAG,CAAC,0EAA0E,CAAC,CAAC;IAC3F,MAAM,IAAI,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;IACrF,MAAM,IAAI,CAAC,GAAG,CAAC,0EAA0E,CAAC,CAAC;IAC3F,MAAM,IAAI,CAAC,GAAG,CAAC,4EAA4E,CAAC,CAAC;AAC/F,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takaro/db",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "An opinionated data layer",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
@@ -12,13 +12,5 @@
12
12
  },
13
13
  "keywords": [],
14
14
  "author": "",
15
- "license": "ISC",
16
- "dependencies": {
17
- "convict": "6.2.4",
18
- "objection": "3.1.5",
19
- "pg": "8.13.0"
20
- },
21
- "devDependencies": {
22
- "@types/convict": "6.1.6"
23
- }
15
+ "license": "ISC"
24
16
  }
@@ -0,0 +1,49 @@
1
+ import { Knex } from 'knex';
2
+
3
+ export async function up(knex: Knex): Promise<void> {
4
+ await knex.schema.alterTable('hooks', (table) => {
5
+ table.text('description').nullable();
6
+ });
7
+
8
+ await knex.schema.alterTable('commands', (table) => {
9
+ table.text('description').nullable();
10
+ });
11
+
12
+ await knex.schema.alterTable('cronJobs', (table) => {
13
+ table.text('description').nullable();
14
+ });
15
+
16
+ await knex.schema.alterTable('functions', (table) => {
17
+ table.text('description').nullable();
18
+ });
19
+
20
+ await knex.raw('ALTER TABLE hooks ADD CONSTRAINT description_length_check CHECK (length(description) <= 131072)');
21
+ await knex.raw('ALTER TABLE commands ADD CONSTRAINT description_length_check CHECK (length(description) <= 131072)');
22
+ await knex.raw(
23
+ 'ALTER TABLE "cronJobs" ADD CONSTRAINT description_length_check CHECK (length(description) <= 131072)',
24
+ );
25
+ await knex.raw('ALTER TABLE functions ADD CONSTRAINT description_length_check CHECK (length(description) <= 131072)');
26
+ }
27
+
28
+ export async function down(knex: Knex): Promise<void> {
29
+ await knex.raw('ALTER TABLE hooks DROP CONSTRAINT description_length_check');
30
+ await knex.raw('ALTER TABLE commands DROP CONSTRAINT description_length_check');
31
+ await knex.raw('ALTER TABLE "cronJobs" DROP CONSTRAINT description_length_check');
32
+ await knex.raw('ALTER TABLE functions DROP CONSTRAINT description_length_check');
33
+
34
+ await knex.schema.alterTable('hooks', (table) => {
35
+ table.dropColumn('description');
36
+ });
37
+
38
+ await knex.schema.alterTable('commands', (table) => {
39
+ table.dropColumn('description');
40
+ });
41
+
42
+ await knex.schema.alterTable('cronJobs', (table) => {
43
+ table.dropColumn('description');
44
+ });
45
+
46
+ await knex.schema.alterTable('functions', (table) => {
47
+ table.dropColumn('description');
48
+ });
49
+ }
@@ -0,0 +1,13 @@
1
+ import { Knex } from 'knex';
2
+
3
+ export async function up(knex: Knex): Promise<void> {
4
+ await knex.schema.alterTable('moduleVersions', (table) => {
5
+ table.jsonb('defaultSystemConfig').nullable();
6
+ });
7
+ }
8
+
9
+ export async function down(knex: Knex): Promise<void> {
10
+ await knex.schema.alterTable('moduleVersions', (table) => {
11
+ table.dropColumn('defaultSystemConfig');
12
+ });
13
+ }
@@ -0,0 +1,13 @@
1
+ import { Knex } from 'knex';
2
+
3
+ export async function up(knex: Knex): Promise<void> {
4
+ await knex.schema.alterTable('domains', (table) => {
5
+ table.unique(['externalReference']);
6
+ });
7
+ }
8
+
9
+ export async function down(knex: Knex): Promise<void> {
10
+ await knex.schema.alterTable('domains', (table) => {
11
+ table.dropUnique(['externalReference']);
12
+ });
13
+ }
@@ -0,0 +1,17 @@
1
+ import { Knex } from 'knex';
2
+
3
+ export async function up(knex: Knex): Promise<void> {
4
+ await knex.raw(`
5
+ UPDATE users
6
+ SET "isDashboardUser" = false
7
+ WHERE name = 'root'
8
+ `);
9
+ }
10
+
11
+ export async function down(knex: Knex): Promise<void> {
12
+ await knex.raw(`
13
+ UPDATE users
14
+ SET "isDashboardUser" = true
15
+ WHERE name = 'root'
16
+ `);
17
+ }
@@ -0,0 +1,26 @@
1
+ import { Knex } from 'knex';
2
+
3
+ /**
4
+ * This migration ensures that all commands,hooks,cronjobs have a unique name inside their module version
5
+ * @param knex
6
+ */
7
+
8
+ export async function up(knex: Knex): Promise<void> {
9
+ await knex.raw(
10
+ `ALTER TABLE "commands" ADD CONSTRAINT "commands_unique_name_versionId" UNIQUE ("name", "versionId");`,
11
+ );
12
+ await knex.raw(`ALTER TABLE "hooks" ADD CONSTRAINT "hooks_unique_name_versionId" UNIQUE ("name", "versionId");`);
13
+ await knex.raw(
14
+ `ALTER TABLE "cronJobs" ADD CONSTRAINT "cronJobs_unique_name_versionId" UNIQUE ("name", "versionId");`,
15
+ );
16
+ await knex.raw(
17
+ `ALTER TABLE "functions" ADD CONSTRAINT "functions_unique_name_versionId" UNIQUE ("name", "versionId");`,
18
+ );
19
+ }
20
+
21
+ export async function down(knex: Knex): Promise<void> {
22
+ await knex.raw(`ALTER TABLE "commands" DROP CONSTRAINT "commands_unique_name_versionId";`);
23
+ await knex.raw(`ALTER TABLE "hooks" DROP CONSTRAINT "hooks_unique_name_versionId";`);
24
+ await knex.raw(`ALTER TABLE "cronJobs" DROP CONSTRAINT "cronJobs_unique_name_versionId";`);
25
+ await knex.raw(`ALTER TABLE "functions" DROP CONSTRAINT "functions_unique_name_versionId";`);
26
+ }