@payloadcms/db-postgres 0.7.0 → 3.0.0-alpha.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. package/dist/connect.d.ts.map +1 -1
  2. package/dist/connect.js +30 -40
  3. package/dist/create.js +6 -21
  4. package/dist/createGlobal.js +6 -21
  5. package/dist/createGlobalVersion.js +10 -25
  6. package/dist/createMigration.js +11 -26
  7. package/dist/createVersion.js +10 -25
  8. package/dist/deleteMany.js +8 -23
  9. package/dist/deleteOne.js +10 -25
  10. package/dist/deleteVersions.js +10 -25
  11. package/dist/destroy.js +2 -12
  12. package/dist/find/buildFindManyArgs.js +6 -14
  13. package/dist/find/chainMethods.js +2 -11
  14. package/dist/find/findMany.js +14 -29
  15. package/dist/find/traverseFields.js +8 -23
  16. package/dist/find.js +6 -21
  17. package/dist/findGlobal.js +6 -21
  18. package/dist/findGlobalVersions.js +8 -23
  19. package/dist/findOne.js +6 -21
  20. package/dist/findVersions.js +8 -23
  21. package/dist/index.d.ts +3 -2
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +76 -88
  24. package/dist/init.js +17 -32
  25. package/dist/migrate.d.ts.map +1 -1
  26. package/dist/migrate.js +15 -33
  27. package/dist/migrateDown.d.ts.map +1 -1
  28. package/dist/migrateDown.js +12 -25
  29. package/dist/migrateFresh.d.ts.map +1 -1
  30. package/dist/migrateFresh.js +15 -31
  31. package/dist/migrateRefresh.d.ts.map +1 -1
  32. package/dist/migrateRefresh.js +18 -29
  33. package/dist/migrateReset.d.ts.map +1 -1
  34. package/dist/migrateReset.js +13 -24
  35. package/dist/migrateStatus.js +9 -19
  36. package/dist/queries/buildAndOrConditions.js +4 -14
  37. package/dist/queries/buildQuery.js +10 -20
  38. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +4 -14
  39. package/dist/queries/createJSONQuery/formatJSONPathSegment.js +2 -12
  40. package/dist/queries/createJSONQuery/index.js +6 -16
  41. package/dist/queries/getTableColumnFromPath.js +38 -49
  42. package/dist/queries/operatorMap.js +17 -27
  43. package/dist/queries/parseParams.js +32 -42
  44. package/dist/queries/sanitizeQueryValue.js +8 -18
  45. package/dist/queryDrafts.js +10 -25
  46. package/dist/schema/build.js +49 -64
  47. package/dist/schema/createIndex.js +5 -15
  48. package/dist/schema/idToUUID.js +2 -12
  49. package/dist/schema/parentIDColumnMap.js +7 -17
  50. package/dist/schema/setColumnID.js +10 -20
  51. package/dist/schema/traverseFields.js +62 -77
  52. package/dist/schema/validateExistingBlockIsIdentical.js +9 -19
  53. package/dist/transactions/beginTransaction.js +4 -14
  54. package/dist/transactions/commitTransaction.js +2 -12
  55. package/dist/transactions/rollbackTransaction.js +2 -12
  56. package/dist/transform/read/hasManyNumber.js +2 -12
  57. package/dist/transform/read/hasManyText.js +2 -12
  58. package/dist/transform/read/index.js +12 -20
  59. package/dist/transform/read/relationship.js +2 -12
  60. package/dist/transform/read/traverseFields.js +15 -23
  61. package/dist/transform/write/array.js +6 -16
  62. package/dist/transform/write/blocks.js +6 -21
  63. package/dist/transform/write/index.js +4 -14
  64. package/dist/transform/write/numbers.js +2 -12
  65. package/dist/transform/write/relationships.js +4 -14
  66. package/dist/transform/write/selects.js +4 -14
  67. package/dist/transform/write/texts.js +2 -12
  68. package/dist/transform/write/traverseFields.js +30 -45
  69. package/dist/transform/write/types.js +2 -5
  70. package/dist/types.js +2 -5
  71. package/dist/update.js +11 -26
  72. package/dist/updateGlobal.js +6 -21
  73. package/dist/updateGlobalVersion.js +10 -25
  74. package/dist/updateVersion.js +10 -25
  75. package/dist/upsertRow/deleteExistingArrayRows.js +5 -15
  76. package/dist/upsertRow/deleteExistingRowsByPath.js +9 -19
  77. package/dist/upsertRow/index.d.ts.map +1 -1
  78. package/dist/upsertRow/index.js +25 -36
  79. package/dist/upsertRow/insertArrays.js +2 -12
  80. package/dist/upsertRow/types.js +2 -5
  81. package/dist/utilities/appendPrefixToKeys.js +2 -12
  82. package/dist/utilities/createBlocksMap.js +2 -12
  83. package/dist/utilities/createMigrationTable.js +4 -14
  84. package/dist/utilities/createRelationshipMap.js +2 -12
  85. package/dist/utilities/hasLocalesTable.js +5 -15
  86. package/dist/utilities/isArrayOfRows.js +2 -12
  87. package/dist/utilities/migrationTableExists.js +4 -14
  88. package/dist/utilities/parseError.js +6 -14
  89. package/package.json +6 -6
package/dist/migrate.js CHANGED
@@ -1,29 +1,11 @@
1
- /* eslint-disable no-restricted-syntax, no-await-in-loop */ "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "migrate", {
6
- enumerable: true,
7
- get: function() {
8
- return migrate;
9
- }
10
- });
11
- const _database = require("payload/database");
12
- const _commitTransaction = require("payload/dist/utilities/commitTransaction");
13
- const _initTransaction = require("payload/dist/utilities/initTransaction");
14
- const _killTransaction = require("payload/dist/utilities/killTransaction");
15
- const _prompts = /*#__PURE__*/ _interop_require_default(require("prompts"));
16
- const _createMigrationTable = require("./utilities/createMigrationTable");
17
- const _migrationTableExists = require("./utilities/migrationTableExists");
18
- const _parseError = require("./utilities/parseError");
19
- function _interop_require_default(obj) {
20
- return obj && obj.__esModule ? obj : {
21
- default: obj
22
- };
23
- }
24
- async function migrate() {
1
+ /* eslint-disable no-restricted-syntax, no-await-in-loop */ import { commitTransaction, initTransaction, killTransaction, readMigrationFiles } from 'payload/database';
2
+ import prompts from 'prompts';
3
+ import { createMigrationTable } from './utilities/createMigrationTable';
4
+ import { migrationTableExists } from './utilities/migrationTableExists';
5
+ import { parseError } from './utilities/parseError';
6
+ export async function migrate() {
25
7
  const { payload } = this;
26
- const migrationFiles = await (0, _database.readMigrationFiles)({
8
+ const migrationFiles = await readMigrationFiles({
27
9
  payload
28
10
  });
29
11
  if (!migrationFiles.length) {
@@ -34,7 +16,7 @@ async function migrate() {
34
16
  }
35
17
  let latestBatch = 0;
36
18
  let migrationsInDB = [];
37
- const hasMigrationTable = await (0, _migrationTableExists.migrationTableExists)(this.drizzle);
19
+ const hasMigrationTable = await migrationTableExists(this.drizzle);
38
20
  if (hasMigrationTable) {
39
21
  ({ docs: migrationsInDB } = await payload.find({
40
22
  collection: 'payload-migrations',
@@ -45,10 +27,10 @@ async function migrate() {
45
27
  latestBatch = Number(migrationsInDB[0]?.batch);
46
28
  }
47
29
  } else {
48
- await (0, _createMigrationTable.createMigrationTable)(this);
30
+ await createMigrationTable(this);
49
31
  }
50
32
  if (migrationsInDB.find((m)=>m.batch === -1)) {
51
- const { confirm: runMigrations } = await (0, _prompts.default)({
33
+ const { confirm: runMigrations } = await prompts({
52
34
  name: 'confirm',
53
35
  type: 'confirm',
54
36
  initial: false,
@@ -85,7 +67,7 @@ async function runMigrationFile(payload, migration, batch) {
85
67
  const pgAdapter = payload.db;
86
68
  const drizzleJSON = generateDrizzleJson(pgAdapter.schema);
87
69
  try {
88
- await (0, _initTransaction.initTransaction)(req);
70
+ await initTransaction(req);
89
71
  await migration.up({
90
72
  payload,
91
73
  req
@@ -102,14 +84,14 @@ async function runMigrationFile(payload, migration, batch) {
102
84
  },
103
85
  req
104
86
  });
105
- await (0, _commitTransaction.commitTransaction)(req);
87
+ await commitTransaction(req);
106
88
  } catch (err) {
107
- await (0, _killTransaction.killTransaction)(req);
89
+ await killTransaction(req);
108
90
  payload.logger.error({
109
91
  err,
110
- msg: (0, _parseError.parseError)(err, `Error running migration ${migration.name}`)
92
+ msg: parseError(err, `Error running migration ${migration.name}`)
111
93
  });
112
94
  }
113
95
  }
114
96
 
115
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG5vLXJlc3RyaWN0ZWQtc3ludGF4LCBuby1hd2FpdC1pbi1sb29wICovXG5pbXBvcnQgdHlwZSB7IFBheWxvYWQgfSBmcm9tICdwYXlsb2FkJ1xuaW1wb3J0IHR5cGUgeyBNaWdyYXRpb24gfSBmcm9tICdwYXlsb2FkL2Rhd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0p4QixNQUFNUSxVQUFVUixJQUFJO2dCQUNwQko7Z0JBQ0F5QixRQUFRRDtZQUNWO1lBQ0FIO1FBQ0Y7UUFDQSxNQUFNOUMsa0JBQWtCOEM7SUFDMUIsRUFBRSxPQUFPUSxLQUFjO1FBQ3JCLE1BQU1wRCxnQkFBZ0I0QztRQUN0QnJDLFFBQVFHLE1BQU0sQ0FBQzJDLEtBQUssQ0FBQztZQUNuQkQ7WUFDQXhDLEtBQUtQLFdBQVcrQyxLQUFLLENBQUMsd0JBQXdCLEVBQUVqQixVQUFVUixJQUFJLENBQUMsQ0FBQztRQUNsRTtJQUNGO0FBQ0YifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"migrateDown.d.ts","sourceRoot":"","sources":["../src/migrateDown.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAwDtE"}
1
+ {"version":3,"file":"migrateDown.d.ts","sourceRoot":"","sources":["../src/migrateDown.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAwDtE"}
@@ -1,25 +1,12 @@
1
- /* eslint-disable no-restricted-syntax, no-await-in-loop */ "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "migrateDown", {
6
- enumerable: true,
7
- get: function() {
8
- return migrateDown;
9
- }
10
- });
11
- const _database = require("payload/database");
12
- const _commitTransaction = require("payload/dist/utilities/commitTransaction");
13
- const _initTransaction = require("payload/dist/utilities/initTransaction");
14
- const _killTransaction = require("payload/dist/utilities/killTransaction");
15
- const _migrationTableExists = require("./utilities/migrationTableExists");
16
- const _parseError = require("./utilities/parseError");
17
- async function migrateDown() {
1
+ /* eslint-disable no-restricted-syntax, no-await-in-loop */ import { commitTransaction, getMigrations, initTransaction, killTransaction, readMigrationFiles } from 'payload/database';
2
+ import { migrationTableExists } from './utilities/migrationTableExists';
3
+ import { parseError } from './utilities/parseError';
4
+ export async function migrateDown() {
18
5
  const { payload } = this;
19
- const migrationFiles = await (0, _database.readMigrationFiles)({
6
+ const migrationFiles = await readMigrationFiles({
20
7
  payload
21
8
  });
22
- const { existingMigrations, latestBatch } = await (0, _database.getMigrations)({
9
+ const { existingMigrations, latestBatch } = await getMigrations({
23
10
  payload
24
11
  });
25
12
  if (!existingMigrations?.length) {
@@ -45,7 +32,7 @@ async function migrateDown() {
45
32
  payload.logger.info({
46
33
  msg: `Migrating down: ${migrationFile.name}`
47
34
  });
48
- await (0, _initTransaction.initTransaction)(req);
35
+ await initTransaction(req);
49
36
  await migrationFile.down({
50
37
  payload,
51
38
  req
@@ -53,7 +40,7 @@ async function migrateDown() {
53
40
  payload.logger.info({
54
41
  msg: `Migrated down: ${migrationFile.name} (${Date.now() - start}ms)`
55
42
  });
56
- const tableExists = await (0, _migrationTableExists.migrationTableExists)(this.drizzle);
43
+ const tableExists = await migrationTableExists(this.drizzle);
57
44
  if (tableExists) {
58
45
  await payload.delete({
59
46
  id: migration.id,
@@ -61,16 +48,16 @@ async function migrateDown() {
61
48
  req
62
49
  });
63
50
  }
64
- await (0, _commitTransaction.commitTransaction)(req);
51
+ await commitTransaction(req);
65
52
  } catch (err) {
66
- await (0, _killTransaction.killTransaction)(req);
53
+ await killTransaction(req);
67
54
  payload.logger.error({
68
55
  err,
69
- msg: (0, _parseError.parseError)(err, `Error migrating down ${migrationFile.name}. Rolling back.`)
56
+ msg: parseError(err, `Error migrating down ${migrationFile.name}. Rolling back.`)
70
57
  });
71
58
  process.exit(1);
72
59
  }
73
60
  }
74
61
  }
75
62
 
76
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9ta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AAC,IAAI,CAAC,CAgEf"}
1
+ {"version":3,"file":"migrateFresh.d.ts","sourceRoot":"","sources":["../src/migrateFresh.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,eAAe,EACrB,EAAE,kBAA0B,EAAE;;CAAA,GAC7B,OAAO,CAAC,IAAI,CAAC,CAgEf"}
@@ -1,29 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "migrateFresh", {
6
- enumerable: true,
7
- get: function() {
8
- return migrateFresh;
9
- }
10
- });
11
- const _drizzleorm = require("drizzle-orm");
12
- const _database = require("payload/database");
13
- const _commitTransaction = require("payload/dist/utilities/commitTransaction");
14
- const _initTransaction = require("payload/dist/utilities/initTransaction");
15
- const _killTransaction = require("payload/dist/utilities/killTransaction");
16
- const _prompts = /*#__PURE__*/ _interop_require_default(require("prompts"));
17
- const _parseError = require("./utilities/parseError");
18
- function _interop_require_default(obj) {
19
- return obj && obj.__esModule ? obj : {
20
- default: obj
21
- };
22
- }
23
- async function migrateFresh({ forceAcceptWarning = false }) {
1
+ import { sql } from 'drizzle-orm';
2
+ import { commitTransaction, initTransaction, killTransaction, readMigrationFiles } from 'payload/database';
3
+ import prompts from 'prompts';
4
+ import { parseError } from './utilities/parseError';
5
+ /**
6
+ * Drop the current database and run all migrate up functions
7
+ */ export async function migrateFresh({ forceAcceptWarning = false }) {
24
8
  const { payload } = this;
25
9
  if (forceAcceptWarning === false) {
26
- const { confirm: acceptWarning } = await (0, _prompts.default)({
10
+ const { confirm: acceptWarning } = await prompts({
27
11
  name: 'confirm',
28
12
  type: 'confirm',
29
13
  initial: false,
@@ -40,9 +24,9 @@ async function migrateFresh({ forceAcceptWarning = false }) {
40
24
  payload.logger.info({
41
25
  msg: `Dropping database.`
42
26
  });
43
- await this.drizzle.execute(_drizzleorm.sql.raw(`drop schema ${this.schemaName || 'public'} cascade;
27
+ await this.drizzle.execute(sql.raw(`drop schema ${this.schemaName || 'public'} cascade;
44
28
  create schema ${this.schemaName || 'public'};`));
45
- const migrationFiles = await (0, _database.readMigrationFiles)({
29
+ const migrationFiles = await readMigrationFiles({
46
30
  payload
47
31
  });
48
32
  payload.logger.debug({
@@ -58,7 +42,7 @@ async function migrateFresh({ forceAcceptWarning = false }) {
58
42
  });
59
43
  try {
60
44
  const start = Date.now();
61
- await (0, _initTransaction.initTransaction)(req);
45
+ await initTransaction(req);
62
46
  await migration.up({
63
47
  payload,
64
48
  req
@@ -71,18 +55,18 @@ async function migrateFresh({ forceAcceptWarning = false }) {
71
55
  },
72
56
  req
73
57
  });
74
- await (0, _commitTransaction.commitTransaction)(req);
58
+ await commitTransaction(req);
75
59
  payload.logger.info({
76
60
  msg: `Migrated: ${migration.name} (${Date.now() - start}ms)`
77
61
  });
78
62
  } catch (err) {
79
- await (0, _killTransaction.killTransaction)(req);
63
+ await killTransaction(req);
80
64
  payload.logger.error({
81
65
  err,
82
- msg: (0, _parseError.parseError)(err, `Error running migration ${migration.name}. Rolling back`)
66
+ msg: parseError(err, `Error running migration ${migration.name}. Rolling back`)
83
67
  });
84
68
  }
85
69
  }
86
70
  }
87
71
 
88
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlRnJlc2gudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IHNxbCB9IGZyb20gJ2RyaXp6bGUtb3JtJ1xuaW1wb3J0IHsgcmVhZE1pZ3JhdGlvbkZpbGVzIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB7IGNvbW1pdFRyYW5zYWN0aW9uIH0gZnJvbSAncGF5bG9h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sR0FBRztZQUN0QixNQUFNL0IsZ0JBQWdCMkI7WUFDdEIsTUFBTUMsVUFBVUksRUFBRSxDQUFDO2dCQUFFekI7Z0JBQVNvQjtZQUFJO1lBQ2xDLE1BQU1wQixRQUFRMEIsTUFBTSxDQUFDO2dCQUNuQkMsWUFBWTtnQkFDWkMsTUFBTTtvQkFDSnpCLE1BQU1rQixVQUFVbEIsSUFBSTtvQkFDcEIwQixPQUFPO2dCQUNUO2dCQUNBVDtZQUNGO1lBQ0EsTUFBTTVCLGtCQUFrQjRCO1lBRXhCcEIsUUFBUVUsTUFBTSxDQUFDQyxJQUFJLENBQUM7Z0JBQUVDLEtBQUssQ0FBQyxXQUFXLEVBQUVTLFVBQVVsQixJQUFJLENBQUMsRUFBRSxFQUFFb0IsS0FBS0MsR0FBRyxLQUFLRixNQUFNLEdBQUcsQ0FBQztZQUFDO1FBQ3RGLEVBQUUsT0FBT1EsS0FBYztZQUNyQixNQUFNcEMsZ0JBQWdCMEI7WUFDdEJwQixRQUFRVSxNQUFNLENBQUNxQixLQUFLLENBQUM7Z0JBQ25CRDtnQkFDQWxCLEtBQUtmLFdBQVdpQyxLQUFLLENBQUMsd0JBQXdCLEVBQUVULFVBQVVsQixJQUFJLENBQUMsY0FBYyxDQUFDO1lBQ2hGO1FBQ0Y7SUFDRjtBQUNGIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"migrateRefresh.d.ts","sourceRoot":"","sources":["../src/migrateRefresh.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,eAAe,iBAsFzD"}
1
+ {"version":3,"file":"migrateRefresh.d.ts","sourceRoot":"","sources":["../src/migrateRefresh.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,eAAe,iBAsFzD"}
@@ -1,25 +1,14 @@
1
- /* eslint-disable no-restricted-syntax, no-await-in-loop */ "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "migrateRefresh", {
6
- enumerable: true,
7
- get: function() {
8
- return migrateRefresh;
9
- }
10
- });
11
- const _database = require("payload/database");
12
- const _commitTransaction = require("payload/dist/utilities/commitTransaction");
13
- const _initTransaction = require("payload/dist/utilities/initTransaction");
14
- const _killTransaction = require("payload/dist/utilities/killTransaction");
15
- const _migrationTableExists = require("./utilities/migrationTableExists");
16
- const _parseError = require("./utilities/parseError");
17
- async function migrateRefresh() {
1
+ /* eslint-disable no-restricted-syntax, no-await-in-loop */ import { commitTransaction, getMigrations, initTransaction, killTransaction, readMigrationFiles } from 'payload/database';
2
+ import { migrationTableExists } from './utilities/migrationTableExists';
3
+ import { parseError } from './utilities/parseError';
4
+ /**
5
+ * Run all migration down functions before running up
6
+ */ export async function migrateRefresh() {
18
7
  const { payload } = this;
19
- const migrationFiles = await (0, _database.readMigrationFiles)({
8
+ const migrationFiles = await readMigrationFiles({
20
9
  payload
21
10
  });
22
- const { existingMigrations, latestBatch } = await (0, _database.getMigrations)({
11
+ const { existingMigrations, latestBatch } = await getMigrations({
23
12
  payload
24
13
  });
25
14
  if (!existingMigrations?.length) {
@@ -46,7 +35,7 @@ async function migrateRefresh() {
46
35
  msg: `Migrating down: ${migration.name}`
47
36
  });
48
37
  const start = Date.now();
49
- await (0, _initTransaction.initTransaction)(req);
38
+ await initTransaction(req);
50
39
  await migrationFile.down({
51
40
  payload,
52
41
  req
@@ -54,7 +43,7 @@ async function migrateRefresh() {
54
43
  payload.logger.info({
55
44
  msg: `Migrated down: ${migration.name} (${Date.now() - start}ms)`
56
45
  });
57
- const tableExists = await (0, _migrationTableExists.migrationTableExists)(this.drizzle);
46
+ const tableExists = await migrationTableExists(this.drizzle);
58
47
  if (tableExists) {
59
48
  await payload.delete({
60
49
  collection: 'payload-migrations',
@@ -66,12 +55,12 @@ async function migrateRefresh() {
66
55
  }
67
56
  });
68
57
  }
69
- await (0, _commitTransaction.commitTransaction)(req);
58
+ await commitTransaction(req);
70
59
  } catch (err) {
71
- await (0, _killTransaction.killTransaction)(req);
60
+ await killTransaction(req);
72
61
  payload.logger.error({
73
62
  err,
74
- msg: (0, _parseError.parseError)(err, `Error running migration ${migration.name}. Rolling back.`)
63
+ msg: parseError(err, `Error running migration ${migration.name}. Rolling back.`)
75
64
  });
76
65
  process.exit(1);
77
66
  }
@@ -83,7 +72,7 @@ async function migrateRefresh() {
83
72
  });
84
73
  try {
85
74
  const start = Date.now();
86
- await (0, _initTransaction.initTransaction)(req);
75
+ await initTransaction(req);
87
76
  await migration.up({
88
77
  payload,
89
78
  req
@@ -96,18 +85,18 @@ async function migrateRefresh() {
96
85
  },
97
86
  req
98
87
  });
99
- await (0, _commitTransaction.commitTransaction)(req);
88
+ await commitTransaction(req);
100
89
  payload.logger.info({
101
90
  msg: `Migrated: ${migration.name} (${Date.now() - start}ms)`
102
91
  });
103
92
  } catch (err) {
104
- await (0, _killTransaction.killTransaction)(req);
93
+ await killTransaction(req);
105
94
  payload.logger.error({
106
95
  err,
107
- msg: (0, _parseError.parseError)(err, `Error running migration ${migration.name}. Rolling back.`)
96
+ msg: parseError(err, `Error running migration ${migration.name}. Rolling back.`)
108
97
  });
109
98
  }
110
99
  }
111
100
  }
112
101
 
113
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlUmVmcmVzaC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGlzYWJsZSBuby1yZXN0cmljdGVkLXN5bnRheCwgbm8tYXdhaXQtaW4tbG9vcCAqL1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IGdldE1pZ3JhdGlvb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UFBSTtZQUNsQyxNQUFNUixRQUFRK0IsTUFBTSxDQUFDO2dCQUNuQlIsWUFBWTtnQkFDWlMsTUFBTTtvQkFDSmxCLE1BQU1KLFVBQVVJLElBQUk7b0JBQ3BCbUIsVUFBVTtnQkFDWjtnQkFDQXpCO1lBQ0Y7WUFDQSxNQUFNaEIsa0JBQWtCZ0I7WUFFeEJSLFFBQVFLLE1BQU0sQ0FBQ0MsSUFBSSxDQUFDO2dCQUFFQyxLQUFLLENBQUMsV0FBVyxFQUFFRyxVQUFVSSxJQUFJLENBQUMsRUFBRSxFQUFFRyxLQUFLQyxHQUFHLEtBQUtGLE1BQU0sR0FBRyxDQUFDO1lBQUM7UUFDdEYsRUFBRSxPQUFPVSxLQUFjO1lBQ3JCLE1BQU0vQixnQkFBZ0JhO1lBQ3RCUixRQUFRSyxNQUFNLENBQUNzQixLQUFLLENBQUM7Z0JBQ25CRDtnQkFDQW5CLEtBQUtULFdBQVc0QixLQUFLLENBQUMsd0JBQXdCLEVBQUVoQixVQUFVSSxJQUFJLENBQUMsZUFBZSxDQUFDO1lBQ2pGO1FBQ0Y7SUFDRjtBQUNGIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"migrateReset.d.ts","sourceRoot":"","sources":["../src/migrateReset.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAsEvE"}
1
+ {"version":3,"file":"migrateReset.d.ts","sourceRoot":"","sources":["../src/migrateReset.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAsEvE"}
@@ -1,24 +1,13 @@
1
- /* eslint-disable no-restricted-syntax, no-await-in-loop */ "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "migrateReset", {
6
- enumerable: true,
7
- get: function() {
8
- return migrateReset;
9
- }
10
- });
11
- const _database = require("payload/database");
12
- const _commitTransaction = require("payload/dist/utilities/commitTransaction");
13
- const _initTransaction = require("payload/dist/utilities/initTransaction");
14
- const _killTransaction = require("payload/dist/utilities/killTransaction");
15
- const _migrationTableExists = require("./utilities/migrationTableExists");
16
- async function migrateReset() {
1
+ /* eslint-disable no-restricted-syntax, no-await-in-loop */ import { commitTransaction, getMigrations, initTransaction, killTransaction, readMigrationFiles } from 'payload/database';
2
+ import { migrationTableExists } from './utilities/migrationTableExists';
3
+ /**
4
+ * Run all migrate down functions
5
+ */ export async function migrateReset() {
17
6
  const { payload } = this;
18
- const migrationFiles = await (0, _database.readMigrationFiles)({
7
+ const migrationFiles = await readMigrationFiles({
19
8
  payload
20
9
  });
21
- const { existingMigrations } = await (0, _database.getMigrations)({
10
+ const { existingMigrations } = await getMigrations({
22
11
  payload
23
12
  });
24
13
  if (!existingMigrations?.length) {
@@ -41,7 +30,7 @@ async function migrateReset() {
41
30
  payload.logger.info({
42
31
  msg: `Migrating down: ${migrationFile.name}`
43
32
  });
44
- await (0, _initTransaction.initTransaction)(req);
33
+ await initTransaction(req);
45
34
  await migrationFile.down({
46
35
  payload,
47
36
  req
@@ -49,7 +38,7 @@ async function migrateReset() {
49
38
  payload.logger.info({
50
39
  msg: `Migrated down: ${migrationFile.name} (${Date.now() - start}ms)`
51
40
  });
52
- const tableExists = await (0, _migrationTableExists.migrationTableExists)(this.drizzle);
41
+ const tableExists = await migrationTableExists(this.drizzle);
53
42
  if (tableExists) {
54
43
  await payload.delete({
55
44
  id: migration.id,
@@ -57,11 +46,11 @@ async function migrateReset() {
57
46
  req
58
47
  });
59
48
  }
60
- await (0, _commitTransaction.commitTransaction)(req);
49
+ await commitTransaction(req);
61
50
  } catch (err) {
62
51
  let msg = `Error running migration ${migrationFile.name}.`;
63
52
  if (err instanceof Error) msg += ` ${err.message}`;
64
- await (0, _killTransaction.killTransaction)(req);
53
+ await killTransaction(req);
65
54
  payload.logger.error({
66
55
  err,
67
56
  msg
@@ -70,7 +59,7 @@ async function migrateReset() {
70
59
  }
71
60
  }
72
61
  // Delete dev migration
73
- const tableExists = await (0, _migrationTableExists.migrationTableExists)(this.drizzle);
62
+ const tableExists = await migrationTableExists(this.drizzle);
74
63
  if (tableExists) {
75
64
  try {
76
65
  await payload.delete({
@@ -90,4 +79,4 @@ async function migrateReset() {
90
79
  }
91
80
  }
92
81
 
93
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlUmVzZXQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcmVzdHJpY3RlZC1zeW50YXgsIG5vLWF3YWl0LWluLWxvb3AgKi9cbmltcG9ydCB0eXBlIHsgUGF5bG9hZFJlcXVlc3QgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgeyBnZXRNaWdyYXRpb25zLCByZWFkTWlncmF0aW9uRmlsZXMgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHsgY29tbWl0VHJhbnNhY3Rpb24gfSBmcm9tICdwYXlsb2FkL2Rpc3QvdXRpbGl0aWVzL2NvbW1pdFRyYW5zYWN0aW9uJ1xuaW1wb3J0IHsgaW5pdFRyYW5zYWN0aW9uIH0gZnJvbSAncGF5bG9hZC9kaXN0L3V0aWxpdGllcy9pbml0VHJhbnNhY3Rpb24nXG5pbXBvcnQgeyBraWxsVHJhbnNhY3Rpb24gfSBmcm9tICdwYXlsb2FkL2Rpc3QvdXRpbGl0aWVzL2tpbGxUcmFuc2FjdGlvbidcblxuaW1wb3J0IHR5cGUgeyBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuL3R5cGVzJ1xu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