@cosmicdrift/kumiko-framework 0.162.0 → 0.163.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-framework",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.163.0",
|
|
4
4
|
"description": "Framework core — engine, pipeline, API, DB, and every other bit that makes Kumiko go.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
"./package.json": "./package.json"
|
|
183
183
|
},
|
|
184
184
|
"dependencies": {
|
|
185
|
-
"@cosmicdrift/kumiko-types": "0.
|
|
185
|
+
"@cosmicdrift/kumiko-types": "0.163.0",
|
|
186
186
|
"bullmq": "^5.76.7",
|
|
187
187
|
"bun-types": "^1.3.13",
|
|
188
188
|
"hono": "^4.12.18",
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"zod": "^4.4.3"
|
|
199
199
|
},
|
|
200
200
|
"devDependencies": {
|
|
201
|
-
"@cosmicdrift/kumiko-dispatcher-live": "0.
|
|
201
|
+
"@cosmicdrift/kumiko-dispatcher-live": "0.163.0",
|
|
202
202
|
"bun-types": "^1.3.13",
|
|
203
203
|
"pino-pretty": "^13.1.3"
|
|
204
204
|
},
|
|
@@ -56,6 +56,38 @@ CREATE INDEX IF NOT EXISTS "read_accounts_tenant_id_idx" ON "read_accounts" ("te
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
+
// Hand-edited migrations legitimately add "IF NOT EXISTS"/"IF EXISTS" to
|
|
60
|
+
// ADD/DROP COLUMN (the generator itself never emits it, but app authors
|
|
61
|
+
// are explicitly allowed to hand-edit before committing — see the header
|
|
62
|
+
// comment every generated migration carries).
|
|
63
|
+
test("ADD COLUMN IF NOT EXISTS (hand-edited) still extends the table", () => {
|
|
64
|
+
const dir = tmpMigrationsDir();
|
|
65
|
+
try {
|
|
66
|
+
write(dir, "0001_init.sql", `CREATE TABLE IF NOT EXISTS "read_a" ("id" uuid PRIMARY KEY);`);
|
|
67
|
+
write(dir, "0002_add-col.sql", `ALTER TABLE "read_a" ADD COLUMN IF NOT EXISTS "title" text;`);
|
|
68
|
+
const replayed = replayMigrationsDir(dir);
|
|
69
|
+
expect([...(replayed.get("read_a")?.columns ?? [])].sort()).toEqual(["id", "title"]);
|
|
70
|
+
} finally {
|
|
71
|
+
rmSync(dir, { recursive: true, force: true });
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("DROP COLUMN IF EXISTS (hand-edited) still removes the column", () => {
|
|
76
|
+
const dir = tmpMigrationsDir();
|
|
77
|
+
try {
|
|
78
|
+
write(
|
|
79
|
+
dir,
|
|
80
|
+
"0001_init.sql",
|
|
81
|
+
`CREATE TABLE IF NOT EXISTS "read_a" ("id" uuid PRIMARY KEY, "title" text);`,
|
|
82
|
+
);
|
|
83
|
+
write(dir, "0002_drop-col.sql", `ALTER TABLE "read_a" DROP COLUMN IF EXISTS "title";`);
|
|
84
|
+
const replayed = replayMigrationsDir(dir);
|
|
85
|
+
expect([...(replayed.get("read_a")?.columns ?? [])]).toEqual(["id"]);
|
|
86
|
+
} finally {
|
|
87
|
+
rmSync(dir, { recursive: true, force: true });
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
59
91
|
test("commented-out destructive DROP TABLE is not replayed", () => {
|
|
60
92
|
const dir = tmpMigrationsDir();
|
|
61
93
|
try {
|
|
@@ -57,14 +57,18 @@ function applyStatement(schema: Map<string, { columns: Set<string> }>, statement
|
|
|
57
57
|
const createTableName = create?.[1];
|
|
58
58
|
const createBody = create?.[2];
|
|
59
59
|
|
|
60
|
-
const addColumn = statement.match(
|
|
60
|
+
const addColumn = statement.match(
|
|
61
|
+
/^ALTER TABLE\s+"([^"]+)"\s+ADD COLUMN\s+(?:IF NOT EXISTS\s+)?"([^"]+)"/i,
|
|
62
|
+
);
|
|
61
63
|
const addColumnTable = addColumn?.[1];
|
|
62
64
|
const addColumnName = addColumn?.[2];
|
|
63
65
|
|
|
64
66
|
const dropTable = statement.match(/^DROP TABLE\s+(?:IF EXISTS\s+)?"([^"]+)"/i);
|
|
65
67
|
const dropTableName = dropTable?.[1];
|
|
66
68
|
|
|
67
|
-
const dropColumn = statement.match(
|
|
69
|
+
const dropColumn = statement.match(
|
|
70
|
+
/^ALTER TABLE\s+"([^"]+)"\s+DROP COLUMN\s+(?:IF EXISTS\s+)?"([^"]+)"/i,
|
|
71
|
+
);
|
|
68
72
|
const dropColumnTable = dropColumn?.[1];
|
|
69
73
|
const dropColumnName = dropColumn?.[2];
|
|
70
74
|
|