fix: skip comment-only migration SQL
Quality / quality (ubuntu-latest) (push) Failing after 9m47s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-12 19:30:30 +05:30
parent 7a968977f6
commit d47c57a953
6 changed files with 69 additions and 8 deletions
+17
View File
@@ -9,6 +9,7 @@ import {
createTableSql,
parseMigration,
applyMigrations,
appliedMigrations,
migrate,
status,
rollback,
@@ -144,6 +145,22 @@ test("an empty migration set does not touch the database", async () => {
expect(await applyMigrations(db, [])).toEqual([]);
});
test("comment-only migrations are recorded without executing empty SQL", async () => {
const db = createDb(sqlite());
const migrations = [
{
name: "0001_placeholder",
up: "-- Create application tables here.\n/* No schema yet. */\n;",
down: "-- Nothing to roll back.",
},
];
expect(await applyMigrations(db, migrations)).toEqual(["0001_placeholder"]);
expect(await appliedMigrations(db)).toEqual(["0001_placeholder"]);
expect(await rollback(db, ".", { lock: false })).toBe("0001_placeholder");
await db.close();
});
test("migration dry-run plans changes without applying schema and honors cancellation", async () => {
const db = createDb(sqlite());
const migrations = [