@payloadcms/db-postgres 0.1.0-beta.15 → 0.1.0-beta.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAmB,qBAAqB,EAAE,MAAM,SAAS,CAAA;AA+B3E,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7D,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,qBAAqB,CAsDjE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAmB,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAmC3E,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7D,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,qBAAqB,CA0DjE"}
package/dist/index.js CHANGED
@@ -29,6 +29,10 @@ const _findOne = require("./findOne");
29
29
  const _findVersions = require("./findVersions");
30
30
  const _init = require("./init");
31
31
  const _migrate = require("./migrate");
32
+ const _migrateDown = require("./migrateDown");
33
+ const _migrateFresh = require("./migrateFresh");
34
+ const _migrateRefresh = require("./migrateRefresh");
35
+ const _migrateReset = require("./migrateReset");
32
36
  const _migrateStatus = require("./migrateStatus");
33
37
  const _queryDrafts = require("./queryDrafts");
34
38
  const _beginTransaction = require("./transactions/beginTransaction");
@@ -80,6 +84,10 @@ function postgresAdapter(args) {
80
84
  findVersions: _findVersions.findVersions,
81
85
  init: _init.init,
82
86
  migrate: _migrate.migrate,
87
+ migrateDown: _migrateDown.migrateDown,
88
+ migrateFresh: _migrateFresh.migrateFresh,
89
+ migrateRefresh: _migrateRefresh.migrateRefresh,
90
+ migrateReset: _migrateReset.migrateReset,
83
91
  migrateStatus: _migrateStatus.migrateStatus,
84
92
  migrationDir,
85
93
  payload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0JBQWtCO1lBQ2xCQyxrQkFBQUEsa0NBQWdCO1lBQ2hCQyxtQkFBQUEsb0NBQWlCO1lBQ2pCQyxTQUFBQSxnQkFBTztZQUNQQyxRQUFBQSxjQUFNO1lBQ05DLGNBQUFBLDBCQUFZO1lBQ1pDLHFCQUFBQSx3Q0FBbUI7WUFDbkJDLGlCQUFBQSxnQ0FBZTtZQUNmQyxlQUFBQSw0QkFBYTtZQUNiQyxlQUFlO1lBQ2ZDLFlBQUFBLHNCQUFVO1lBQ1ZDLFdBQUFBLG9CQUFTO1lBQ1RDLGdCQUFBQSw4QkFBYztZQUNkQyxTQUFBQSxnQkFBTztZQUNQQyxNQUFBQSxVQUFJO1lBQ0pDLFlBQUFBLHNCQUFVO1lBQ1ZDLG9CQUFBQSxzQ0FBa0I7WUFDbEJDLFNBQUFBLGdCQUFPO1lBQ1BDLGNBQUFBLDBCQUFZO1lBQ1pDLE1BQUFBLFVBQUk7WUFDSkMsU0FBQUEsZ0JBQU87WUFDUEMsYUFBQUEsd0JBQVc7WUFDWEMsY0FBQUEsMEJBQVk7WUFDWkMsZ0JBQUFBLDhCQUFjO1lBQ2RDLGNBQUFBLDBCQUFZO1lBQ1pDLGVBQUFBLDRCQUFhO1lBQ2IzQztZQUNBRDtZQUNBNkMsYUFBQUEsd0JBQVc7WUFDWEMscUJBQUFBLHdDQUFtQjtZQUNuQkMsY0FBQUEsMEJBQVk7WUFDWkMscUJBQUFBLHdDQUFtQjtZQUNuQkMsV0FBQUEsaUJBQVM7WUFDVEMsZUFBQUEsNEJBQWE7UUFDZjtJQUNGO0lBRUEsT0FBT25EO0FBQ1QifQ==
@@ -0,0 +1,3 @@
1
+ import type { PostgresAdapter } from './types';
2
+ export declare function migrateDown(this: PostgresAdapter): Promise<void>;
3
+ //# sourceMappingURL=migrateDown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrateDown.d.ts","sourceRoot":"","sources":["../src/migrateDown.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA2DtE"}
@@ -0,0 +1,71 @@
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 _migrationTableExists = require("./utilities/migrationTableExists");
13
+ async function migrateDown() {
14
+ const { payload } = this;
15
+ const migrationFiles = await (0, _database.readMigrationFiles)({
16
+ payload
17
+ });
18
+ const { existingMigrations, latestBatch } = await (0, _database.getMigrations)({
19
+ payload
20
+ });
21
+ const migrationsToRollback = existingMigrations.filter((migration)=>migration.batch === latestBatch && migration.batch !== -1);
22
+ if (!migrationsToRollback?.length) {
23
+ payload.logger.info({
24
+ msg: 'No migrations to rollback.'
25
+ });
26
+ return;
27
+ }
28
+ payload.logger.info({
29
+ msg: `Rolling back batch ${latestBatch} consisting of ${migrationsToRollback.length} migration(s).`
30
+ });
31
+ for (const migration of migrationsToRollback){
32
+ const migrationFile = migrationFiles.find((m)=>m.name === migration.name);
33
+ if (!migrationFile) {
34
+ throw new Error(`Migration ${migration.name} not found locally.`);
35
+ }
36
+ const start = Date.now();
37
+ let transactionID;
38
+ try {
39
+ payload.logger.info({
40
+ msg: `Migrating down: ${migrationFile.name}`
41
+ });
42
+ transactionID = await this.beginTransaction();
43
+ await migrationFile.down({
44
+ payload
45
+ });
46
+ payload.logger.info({
47
+ msg: `Migrated down: ${migrationFile.name} (${Date.now() - start}ms)`
48
+ });
49
+ const tableExists = await (0, _migrationTableExists.migrationTableExists)(this.drizzle);
50
+ if (tableExists) {
51
+ await payload.delete({
52
+ id: migration.id,
53
+ collection: 'payload-migrations',
54
+ req: {
55
+ transactionID
56
+ }
57
+ });
58
+ }
59
+ await this.commitTransaction(transactionID);
60
+ } catch (err) {
61
+ await this.rollbackTransaction(transactionID);
62
+ payload.logger.error({
63
+ err,
64
+ msg: `Error running migration ${migrationFile.name}`
65
+ });
66
+ throw err;
67
+ }
68
+ }
69
+ }
70
+
71
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlRG93bi50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGlzYWJsZSBuby1yZXN0cmljdGVkLXN5bnRheCwgbm8tYXdhaXQtaW4tbG9vcCAqL1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IGdldE1pZ3JhdGlvbnMsIHJlYWRNaWdyYXRpb25GaWxlcyB9IGZyb20gJ3BheWxvYWQvZGF0YWJhc2UnXG5cbmltcG9ydCB0eXBlIHsgUG9zdGdyZXNBZGFwdGVyIH0gZnJvbSAnLi90eXBlcydcblxuaW1wb3J0IHsgbWlncmF0aW9uVGFibGVFeGlzdHMgfSBmcm9tICcuL3V0aWxpdGllcy9taWdyYXRpb25UYWJsZUV4aXN0cydcblxuZXhwb3J0IGFzeW5jIGZ1bmN0aW9uIG1pZ3JhdGVEb3duKHRoaXM6IFBvc3RncmVzQWRhcHRlcik6IFByb21pc2U8dm9pZD4ge1xuICBjb25zdCB7IHBheWxvYWQgfSA9IHRoaXNcbiAgY29uc3QgbWlncmF0aW9uRmlsZXMgPSBhd2FpdCByZWFkTWlncmF0aW9uRmlsZXMoeyBwYXlsb2FkIH0pXG5cbiAgY29uc3QgeyBleGlzdGluZ01pZ3JhdGlvbnMsIGxhdGVzdEJhdGNoIH0gPSBhd2FpdCBnZXRNaWdyYXRpb25zKHtcbiAgICBwYXlsb2FkLFxuICB9KVxuXG4gIGNvbnN0IG1pZ3JhdGlvbnNUb1Jv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ckIsVUFBVXFCLEVBQUU7b0JBQ2hCQyxZQUFZO29CQUNaQyxLQUFLO3dCQUNIVDtvQkFDRjtnQkFDRjtZQUNGO1lBRUEsTUFBTSxJQUFJLENBQUNVLGlCQUFpQixDQUFDVjtRQUMvQixFQUFFLE9BQU9XLEtBQWM7WUFDckIsTUFBTSxJQUFJLENBQUNDLG1CQUFtQixDQUFDWjtZQUMvQnRCLFFBQVFXLE1BQU0sQ0FBQ3dCLEtBQUssQ0FBQztnQkFDbkJGO2dCQUNBcEIsS0FBSyxDQUFDLHdCQUF3QixFQUFFQyxjQUFjRyxJQUFJLENBQUMsQ0FBQztZQUN0RDtZQUNBLE1BQU1nQjtRQUNSO0lBQ0Y7QUFDRiJ9
@@ -0,0 +1,6 @@
1
+ import type { PostgresAdapter } from './types';
2
+ /**
3
+ * Drop the current database and run all migrate up functions
4
+ */
5
+ export declare function migrateFresh(this: PostgresAdapter): Promise<void>;
6
+ //# sourceMappingURL=migrateFresh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrateFresh.d.ts","sourceRoot":"","sources":["../src/migrateFresh.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA8DvE"}
@@ -0,0 +1,81 @@
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 _prompts = /*#__PURE__*/ _interop_require_default(require("prompts"));
14
+ function _interop_require_default(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
19
+ async function migrateFresh() {
20
+ const { payload } = this;
21
+ const { confirm: acceptWarning } = await (0, _prompts.default)({
22
+ name: 'confirm',
23
+ initial: false,
24
+ message: `WARNING: This will drop your database and run all migrations. Are you sure you want to proceed?`,
25
+ type: 'confirm'
26
+ }, {
27
+ onCancel: ()=>{
28
+ process.exit(0);
29
+ }
30
+ });
31
+ if (!acceptWarning) {
32
+ process.exit(0);
33
+ }
34
+ payload.logger.info({
35
+ msg: `Dropping database.`
36
+ });
37
+ await this.drizzle.execute((0, _drizzleorm.sql)`drop schema public cascade;\ncreate schema public;`);
38
+ const migrationFiles = await (0, _database.readMigrationFiles)({
39
+ payload
40
+ });
41
+ payload.logger.debug({
42
+ msg: `Found ${migrationFiles.length} migration files.`
43
+ });
44
+ let transactionID;
45
+ // Run all migrate up
46
+ for (const migration of migrationFiles){
47
+ payload.logger.info({
48
+ msg: `Migrating: ${migration.name}`
49
+ });
50
+ try {
51
+ const start = Date.now();
52
+ transactionID = await this.beginTransaction();
53
+ await migration.up({
54
+ payload
55
+ });
56
+ await payload.create({
57
+ collection: 'payload-migrations',
58
+ data: {
59
+ name: migration.name,
60
+ batch: 1
61
+ },
62
+ req: {
63
+ transactionID
64
+ }
65
+ });
66
+ await this.commitTransaction(transactionID);
67
+ payload.logger.info({
68
+ msg: `Migrated: ${migration.name} (${Date.now() - start}ms)`
69
+ });
70
+ } catch (err) {
71
+ await this.rollbackTransaction(transactionID);
72
+ payload.logger.error({
73
+ err,
74
+ msg: `Error running migration ${migration.name}. Rolling back.`
75
+ });
76
+ throw err;
77
+ }
78
+ }
79
+ }
80
+
81
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlRnJlc2gudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IHNxbCB9IGZyb20gJ2RyaXp6bGUtb3JtJ1xuaW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QUFDO2dCQUFFM0I7WUFBUTtZQUM3QixNQUFNQSxRQUFRNEIsTUFBTSxDQUFDO2dCQUNuQkMsWUFBWTtnQkFDWkMsTUFBTTtvQkFDSjFCLE1BQU1rQixVQUFVbEIsSUFBSTtvQkFDcEIyQixPQUFPO2dCQUNUO2dCQUNBQyxLQUFLO29CQUNIWDtnQkFDRjtZQUNGO1lBQ0EsTUFBTSxJQUFJLENBQUNZLGlCQUFpQixDQUFDWjtZQUU3QnJCLFFBQVFXLE1BQU0sQ0FBQ0MsSUFBSSxDQUFDO2dCQUFFQyxLQUFLLENBQUMsV0FBVyxFQUFFUyxVQUFVbEIsSUFBSSxDQUFDLEVBQUUsRUFBRW9CLEtBQUtDLEdBQUcsS0FBS0YsTUFBTSxHQUFHLENBQUM7WUFBQztRQUN0RixFQUFFLE9BQU9XLEtBQWM7WUFDckIsTUFBTSxJQUFJLENBQUNDLG1CQUFtQixDQUFDZDtZQUMvQnJCLFFBQVFXLE1BQU0sQ0FBQ3lCLEtBQUssQ0FBQztnQkFDbkJGO2dCQUNBckIsS0FBSyxDQUFDLHdCQUF3QixFQUFFUyxVQUFVbEIsSUFBSSxDQUFDLGVBQWUsQ0FBQztZQUNqRTtZQUNBLE1BQU04QjtRQUNSO0lBQ0Y7QUFDRiJ9
@@ -0,0 +1,6 @@
1
+ import type { PostgresAdapter } from './types';
2
+ /**
3
+ * Run all migration down functions before running up
4
+ */
5
+ export declare function migrateRefresh(this: PostgresAdapter): Promise<void>;
6
+ //# sourceMappingURL=migrateRefresh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrateRefresh.d.ts","sourceRoot":"","sources":["../src/migrateRefresh.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,eAAe,iBAkGzD"}
@@ -0,0 +1,114 @@
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 _migrationTableExists = require("./utilities/migrationTableExists");
13
+ async function migrateRefresh() {
14
+ const { payload } = this;
15
+ const migrationFiles = await (0, _database.readMigrationFiles)({
16
+ payload
17
+ });
18
+ const { existingMigrations, latestBatch } = await (0, _database.getMigrations)({
19
+ payload
20
+ });
21
+ const migrationsToRollback = existingMigrations.filter((migration)=>migration.batch === latestBatch && migration.batch !== -1);
22
+ if (!migrationsToRollback?.length) {
23
+ payload.logger.info({
24
+ msg: 'No migrations to rollback.'
25
+ });
26
+ return;
27
+ }
28
+ payload.logger.info({
29
+ msg: `Rolling back batch ${latestBatch} consisting of ${migrationsToRollback.length} migration(s).`
30
+ });
31
+ let transactionID;
32
+ // Reverse order of migrations to rollback
33
+ migrationsToRollback.reverse();
34
+ for (const migration of migrationsToRollback){
35
+ try {
36
+ const migrationFile = migrationFiles.find((m)=>m.name === migration.name);
37
+ if (!migrationFile) {
38
+ throw new Error(`Migration ${migration.name} not found locally.`);
39
+ }
40
+ payload.logger.info({
41
+ msg: `Migrating down: ${migration.name}`
42
+ });
43
+ const start = Date.now();
44
+ transactionID = await this.beginTransaction();
45
+ await migrationFile.down({
46
+ payload
47
+ });
48
+ payload.logger.info({
49
+ msg: `Migrated down: ${migration.name} (${Date.now() - start}ms)`
50
+ });
51
+ const tableExists = await (0, _migrationTableExists.migrationTableExists)(this.drizzle);
52
+ if (tableExists) {
53
+ await payload.delete({
54
+ collection: 'payload-migrations',
55
+ req: {
56
+ transactionID
57
+ },
58
+ where: {
59
+ name: {
60
+ equals: migration.name
61
+ }
62
+ }
63
+ });
64
+ }
65
+ } catch (err) {
66
+ await this.rollbackTransaction(transactionID);
67
+ let msg = `Error running migration ${migration.name}. Rolling back.`;
68
+ if (err instanceof Error) {
69
+ msg += ` ${err.message}`;
70
+ }
71
+ payload.logger.error({
72
+ err,
73
+ msg
74
+ });
75
+ throw err;
76
+ }
77
+ }
78
+ // Run all migrate up
79
+ for (const migration of migrationFiles){
80
+ payload.logger.info({
81
+ msg: `Migrating: ${migration.name}`
82
+ });
83
+ try {
84
+ const start = Date.now();
85
+ transactionID = await this.beginTransaction();
86
+ await migration.up({
87
+ payload
88
+ });
89
+ await payload.create({
90
+ collection: 'payload-migrations',
91
+ data: {
92
+ name: migration.name,
93
+ executed: true
94
+ },
95
+ req: {
96
+ transactionID
97
+ }
98
+ });
99
+ await this.commitTransaction(transactionID);
100
+ payload.logger.info({
101
+ msg: `Migrated: ${migration.name} (${Date.now() - start}ms)`
102
+ });
103
+ } catch (err) {
104
+ await this.rollbackTransaction(transactionID);
105
+ payload.logger.error({
106
+ err,
107
+ msg: `Error running migration ${migration.name}. Rolling back.`
108
+ });
109
+ throw err;
110
+ }
111
+ }
112
+ }
113
+
114
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlUmVmcmVzaC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGlzYWJsZSBuby1yZXN0cmljdGVkLXN5bnRheCwgbm8tYXdhaXQtaW4tbG9vcCAqL1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IGdldE1pZ3JhdGlvbnMsIHJlYWRNaWdyYXRpb25GaWxlcyB9IGZyb20gJ3BheWxvYWQvZGF0YWJhc2UnXG5cbmltcG9ydCB0eXBlIHsgUG9zdGdyZXNBZGFwdGVyIH0gZnJvbSAnLi90eXBlcydcblxuaW1wb3J0IHsgbWlncmF0aW9uVGFibGVFeGlzdHMgfSBmcm9tICcuL3V0aWxpdGllcy9taWdyYXRpb25UYWJsZUV4aXN0cydcblxuL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sVUFBVVcsSUFBSSxDQUFDLEVBQUUsRUFBRUcsS0FBS0MsR0FBRyxLQUFLRixNQUFNLEdBQUcsQ0FBQztZQUFDO1FBQ3RGLEVBQUUsT0FBT2EsS0FBYztZQUNyQixNQUFNLElBQUksQ0FBQ0MsbUJBQW1CLENBQUNyQjtZQUMvQmQsUUFBUVcsTUFBTSxDQUFDMEIsS0FBSyxDQUFDO2dCQUNuQkg7Z0JBQ0FyQixLQUFLLENBQUMsd0JBQXdCLEVBQUVMLFVBQVVXLElBQUksQ0FBQyxlQUFlLENBQUM7WUFDakU7WUFDQSxNQUFNZTtRQUNSO0lBQ0Y7QUFDRiJ9
@@ -0,0 +1,6 @@
1
+ import type { PostgresAdapter } from './types';
2
+ /**
3
+ * Run all migrate down functions
4
+ */
5
+ export declare function migrateReset(this: PostgresAdapter): Promise<void>;
6
+ //# sourceMappingURL=migrateReset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrateReset.d.ts","sourceRoot":"","sources":["../src/migrateReset.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAoEvE"}
@@ -0,0 +1,87 @@
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 _migrationTableExists = require("./utilities/migrationTableExists");
13
+ async function migrateReset() {
14
+ const { payload } = this;
15
+ const migrationFiles = await (0, _database.readMigrationFiles)({
16
+ payload
17
+ });
18
+ const { existingMigrations } = await (0, _database.getMigrations)({
19
+ payload
20
+ });
21
+ if (!existingMigrations?.length) {
22
+ payload.logger.info({
23
+ msg: 'No migrations to reset.'
24
+ });
25
+ return;
26
+ }
27
+ // Rollback all migrations in order
28
+ for (const migration of existingMigrations){
29
+ const migrationFile = migrationFiles.find((m)=>m.name === migration.name);
30
+ if (!migrationFile) {
31
+ throw new Error(`Migration ${migration.name} not found locally.`);
32
+ }
33
+ const start = Date.now();
34
+ let transactionID;
35
+ try {
36
+ payload.logger.info({
37
+ msg: `Migrating down: ${migrationFile.name}`
38
+ });
39
+ transactionID = await this.beginTransaction();
40
+ await migrationFile.down({
41
+ payload
42
+ });
43
+ payload.logger.info({
44
+ msg: `Migrated down: ${migrationFile.name} (${Date.now() - start}ms)`
45
+ });
46
+ const tableExists = await (0, _migrationTableExists.migrationTableExists)(this.drizzle);
47
+ if (tableExists) {
48
+ await payload.delete({
49
+ id: migration.id,
50
+ collection: 'payload-migrations',
51
+ req: {
52
+ transactionID
53
+ }
54
+ });
55
+ }
56
+ await this.commitTransaction(transactionID);
57
+ } catch (err) {
58
+ await this.rollbackTransaction(transactionID);
59
+ payload.logger.error({
60
+ err,
61
+ msg: `Error running migration ${migrationFile.name}`
62
+ });
63
+ throw err;
64
+ }
65
+ }
66
+ // Delete dev migration
67
+ const tableExists = await (0, _migrationTableExists.migrationTableExists)(this.drizzle);
68
+ if (tableExists) {
69
+ try {
70
+ await payload.delete({
71
+ collection: 'payload-migrations',
72
+ where: {
73
+ batch: {
74
+ equals: -1
75
+ }
76
+ }
77
+ });
78
+ } catch (err) {
79
+ payload.logger.error({
80
+ error: err,
81
+ msg: 'Error deleting dev migration'
82
+ });
83
+ }
84
+ }
85
+ }
86
+
87
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9taWdyYXRlUmVzZXQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcmVzdHJpY3RlZC1zeW50YXgsIG5vLWF3YWl0LWluLWxvb3AgKi9cbmltcG9ydCB0eXBlIHsg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UEsMENBQW9CLEVBQUMsSUFBSSxDQUFDQyxPQUFPO0lBQzNELElBQUlGLGFBQWE7UUFDZixJQUFJO1lBQ0YsTUFBTXJCLFFBQVF3QixNQUFNLENBQUM7Z0JBQ25CRSxZQUFZO2dCQUNaTSxPQUFPO29CQUNMQyxPQUFPO3dCQUNMQyxRQUFRLENBQUM7b0JBQ1g7Z0JBQ0Y7WUFDRjtRQUNGLEVBQUUsT0FBT0wsS0FBYztZQUNyQjdCLFFBQVFNLE1BQU0sQ0FBQ3lCLEtBQUssQ0FBQztnQkFBRUEsT0FBT0Y7Z0JBQUtyQixLQUFLO1lBQStCO1FBQ3pFO0lBQ0Y7QUFDRiJ9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/db-postgres",
3
- "version": "0.1.0-beta.15",
3
+ "version": "0.1.0-beta.16",
4
4
  "description": "The officially supported Postgres database adapter for Payload",
5
5
  "repository": "https://github.com/payloadcms/payload",
6
6
  "license": "MIT",
@@ -24,8 +24,8 @@
24
24
  "devDependencies": {
25
25
  "@types/pg": "8.10.2",
26
26
  "@types/to-snake-case": "1.0.0",
27
- "payload": "2.0.0-beta.19",
28
- "@payloadcms/eslint-config": "0.0.1"
27
+ "@payloadcms/eslint-config": "0.0.1",
28
+ "payload": "2.0.0-beta.26"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "better-sqlite3": "^8.5.0"
package/src/index.ts CHANGED
@@ -24,6 +24,10 @@ import { findOne } from './findOne'
24
24
  import { findVersions } from './findVersions'
25
25
  import { init } from './init'
26
26
  import { migrate } from './migrate'
27
+ import { migrateDown } from './migrateDown'
28
+ import { migrateFresh } from './migrateFresh'
29
+ import { migrateRefresh } from './migrateRefresh'
30
+ import { migrateReset } from './migrateReset'
27
31
  import { migrateStatus } from './migrateStatus'
28
32
  import { queryDrafts } from './queryDrafts'
29
33
  import { beginTransaction } from './transactions/beginTransaction'
@@ -77,6 +81,10 @@ export function postgresAdapter(args: Args): PostgresAdapterResult {
77
81
  findVersions,
78
82
  init,
79
83
  migrate,
84
+ migrateDown,
85
+ migrateFresh,
86
+ migrateRefresh,
87
+ migrateReset,
80
88
  migrateStatus,
81
89
  migrationDir,
82
90
  payload,
@@ -1,15 +0,0 @@
1
- import type { Payload } from 'payload';
2
- import type { Migration } from 'payload/database';
3
- type RunMigrationArgs = {
4
- batch: number;
5
- migration: Migration;
6
- payload: Payload;
7
- };
8
- export declare function runUp({ batch, migration, payload }: RunMigrationArgs): Promise<void>;
9
- type RunMigrationDownArgs = {
10
- migration: Migration;
11
- payload: Payload;
12
- };
13
- export declare function runDown({ migration, payload }: RunMigrationDownArgs): Promise<void>;
14
- export {};
15
- //# sourceMappingURL=migrations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/utilities/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAKjD,KAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,SAAS,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,wBAAsB,KAAK,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,gBAAgB,iBA0B1E;AAED,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,SAAS,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,wBAAsB,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,oBAAoB,iBA4BzE"}
@@ -1,85 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- runUp: function() {
13
- return runUp;
14
- },
15
- runDown: function() {
16
- return runDown;
17
- }
18
- });
19
- const _pg = require("pg");
20
- async function runUp({ batch, migration, payload }) {
21
- const start = Date.now();
22
- payload.logger.info({
23
- msg: `Migrating: ${migration.name}`
24
- });
25
- try {
26
- await migration.up({
27
- payload
28
- });
29
- payload.logger.info({
30
- msg: `Migrated: ${migration.name} (${Date.now() - start}ms)`
31
- });
32
- await payload.create({
33
- collection: 'payload-migrations',
34
- data: {
35
- name: migration.name,
36
- batch
37
- }
38
- });
39
- } catch (err) {
40
- let msg = `Error running migration ${migration.name}`;
41
- if (err instanceof _pg.DatabaseError) {
42
- msg += `: ${err.message}`;
43
- if (err.hint) msg += `. ${err.hint}`;
44
- }
45
- payload.logger.error({
46
- err,
47
- msg
48
- });
49
- throw err;
50
- }
51
- }
52
- async function runDown({ migration, payload }) {
53
- const start = Date.now();
54
- let transactionID;
55
- try {
56
- payload.logger.info({
57
- msg: `Migrating down: ${migration.name}`
58
- });
59
- transactionID = await this.beginTransaction();
60
- await migration.down({
61
- payload
62
- });
63
- payload.logger.info({
64
- msg: `Migrated down: ${migration.name} (${Date.now() - start}ms)`
65
- });
66
- // Waiting for implementation here
67
- await payload.delete({
68
- id: migration.id,
69
- collection: 'payload-migrations',
70
- req: {
71
- transactionID
72
- }
73
- });
74
- await this.commitTransaction(transactionID);
75
- } catch (err) {
76
- await this.rollbackTransaction(transactionID);
77
- payload.logger.error({
78
- err,
79
- msg: `Error running migration ${migration.name}`
80
- });
81
- throw err;
82
- }
83
- }
84
-
85
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvbWlncmF0aW9ucy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IFBheWxvYWQgfSBmcm9tICdwYXlsb2FkJ1xuaW1wb3J0IHR5cGUgeyBNaWdyYXRpb24gfSBmcm9tICdwYXlsb2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