stabilize-orm 1.1.0 → 1.1.1
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/cli/stabilize-cli.ts +9 -11
- package/package.json +1 -1
package/cli/stabilize-cli.ts
CHANGED
|
@@ -3,12 +3,10 @@ import { program } from "commander";
|
|
|
3
3
|
import {
|
|
4
4
|
generateMigration,
|
|
5
5
|
Stabilize,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type LoggerConfig
|
|
10
|
-
runMigrations, // Added runMigrations import
|
|
11
|
-
} from "../src";
|
|
6
|
+
runMigrations
|
|
7
|
+
} from "../";
|
|
8
|
+
|
|
9
|
+
import { LogLevel, type DBConfig, type LoggerConfig } from "../types";
|
|
12
10
|
import * as fs from "fs/promises";
|
|
13
11
|
import * as path from "path";
|
|
14
12
|
import { glob } from "glob";
|
|
@@ -245,7 +243,7 @@ program
|
|
|
245
243
|
orm = new Stabilize(config, { enabled: false, ttl: 60 }, { level: options.logLevel as LogLevel });
|
|
246
244
|
|
|
247
245
|
// 1. Get the last applied migration record from the DB
|
|
248
|
-
const latestApplied = await orm["client"].query
|
|
246
|
+
const latestApplied = await orm["client"].query(
|
|
249
247
|
`SELECT name FROM migrations ORDER BY applied_at DESC LIMIT 1`,
|
|
250
248
|
);
|
|
251
249
|
|
|
@@ -362,7 +360,7 @@ program
|
|
|
362
360
|
let seedsApplied = 0;
|
|
363
361
|
for (const seedName of orderedSeeds) {
|
|
364
362
|
const { file } = seedGraph.get(seedName)!;
|
|
365
|
-
const applied = await orm["client"].query
|
|
363
|
+
const applied = await orm["client"].query(
|
|
366
364
|
`SELECT id FROM seed_history WHERE name = ?`,
|
|
367
365
|
[seedName],
|
|
368
366
|
);
|
|
@@ -431,7 +429,7 @@ program
|
|
|
431
429
|
});
|
|
432
430
|
}
|
|
433
431
|
|
|
434
|
-
const latestSeed = await orm["client"].query
|
|
432
|
+
const latestSeed = await orm["client"].query(
|
|
435
433
|
`SELECT name FROM seed_history ORDER BY applied_at DESC LIMIT 1`,
|
|
436
434
|
);
|
|
437
435
|
|
|
@@ -510,7 +508,7 @@ program
|
|
|
510
508
|
console.log(`---------------------------------`);
|
|
511
509
|
for (const file of migrationFiles.sort()) {
|
|
512
510
|
const migrationName = path.basename(file, ".ts");
|
|
513
|
-
const applied = await orm["client"].query
|
|
511
|
+
const applied = await orm["client"].query(
|
|
514
512
|
`SELECT name FROM migrations WHERE name = ?`,
|
|
515
513
|
[migrationName],
|
|
516
514
|
);
|
|
@@ -536,7 +534,7 @@ program
|
|
|
536
534
|
console.log(`---------------------------------`);
|
|
537
535
|
for (const file of seedFiles.sort()) {
|
|
538
536
|
const seedName = path.basename(file, ".ts");
|
|
539
|
-
const applied = await orm["client"].query
|
|
537
|
+
const applied = await orm["client"].query(
|
|
540
538
|
`SELECT name FROM seed_history WHERE name = ?`,
|
|
541
539
|
[seedName],
|
|
542
540
|
);
|
package/package.json
CHANGED