rake-db 1.3.2 → 1.3.3
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.
- package/dist/lib/migrate.js +4 -4
- package/package.json +1 -1
package/dist/lib/migrate.js
CHANGED
|
@@ -30,8 +30,8 @@ const migration_1 = __importDefault(require("./migration"));
|
|
|
30
30
|
const errorCodes_1 = require("./errorCodes");
|
|
31
31
|
const ts_node_1 = require("ts-node");
|
|
32
32
|
ts_node_1.register({ compilerOptions: { module: 'CommonJS' } });
|
|
33
|
-
const getMigratedVersionsQuery = (db) => db.value(`SELECT COALESCE(json_agg(
|
|
34
|
-
`FROM "schemaMigrations"`);
|
|
33
|
+
const getMigratedVersionsQuery = (db) => db.value(`SELECT COALESCE(json_agg(version ORDER BY version), '[]')` +
|
|
34
|
+
`FROM "public"."schemaMigrations"`);
|
|
35
35
|
const getMigratedVersions = async (db) => {
|
|
36
36
|
try {
|
|
37
37
|
return await getMigratedVersionsQuery(db);
|
|
@@ -100,8 +100,8 @@ const run = async (db, fn, version) => {
|
|
|
100
100
|
if (t.failed)
|
|
101
101
|
return;
|
|
102
102
|
const sql = db.reverse
|
|
103
|
-
? `DELETE FROM "schemaMigrations" WHERE "version" = '${version}'`
|
|
104
|
-
: `INSERT INTO "schemaMigrations"
|
|
103
|
+
? `DELETE FROM "public"."schemaMigrations" WHERE "version" = '${version}'`
|
|
104
|
+
: `INSERT INTO "public"."schemaMigrations"
|
|
105
105
|
VALUES ('${version}')`;
|
|
106
106
|
await t.exec(sql).catch(utils_1.noop);
|
|
107
107
|
});
|