@astrojs/db 0.20.0 → 0.20.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { stripVTControlCharacters } from "node:util";
|
|
2
|
-
import
|
|
2
|
+
import diff from "microdiff";
|
|
3
3
|
import { sql } from "drizzle-orm";
|
|
4
4
|
import { SQLiteAsyncDialect } from "drizzle-orm/sqlite-core";
|
|
5
5
|
import { customAlphabet } from "nanoid";
|
|
@@ -87,7 +87,7 @@ async function getTableChangeQueries({
|
|
|
87
87
|
const updated = getUpdatedColumns(oldTable.columns, newTable.columns);
|
|
88
88
|
const added = getAdded(oldTable.columns, newTable.columns);
|
|
89
89
|
const dropped = getDropped(oldTable.columns, newTable.columns);
|
|
90
|
-
const hasForeignKeyChanges =
|
|
90
|
+
const hasForeignKeyChanges = diff(oldTable.foreignKeys ?? [], newTable.foreignKeys ?? []).length > 0;
|
|
91
91
|
if (!hasForeignKeyChanges && isEmpty(updated) && isEmpty(added) && isEmpty(dropped)) {
|
|
92
92
|
return {
|
|
93
93
|
queries: getChangeIndexQueries({
|
|
@@ -264,7 +264,7 @@ function getUpdated(oldObj, newObj) {
|
|
|
264
264
|
for (const [key, value] of Object.entries(newObj)) {
|
|
265
265
|
const oldValue = oldObj[key];
|
|
266
266
|
if (!oldValue) continue;
|
|
267
|
-
if (
|
|
267
|
+
if (diff(oldValue, value).length > 0) updated[key] = value;
|
|
268
268
|
}
|
|
269
269
|
return updated;
|
|
270
270
|
}
|
|
@@ -282,8 +282,8 @@ function getUpdatedColumns(oldColumns, newColumns) {
|
|
|
282
282
|
oldColumn = asNewColumn.data;
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
const
|
|
286
|
-
if (
|
|
285
|
+
const diffResult = diff(oldColumn, newColumn);
|
|
286
|
+
if (diffResult.length > 0) {
|
|
287
287
|
updated[key] = { old: oldColumn, new: newColumn };
|
|
288
288
|
}
|
|
289
289
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/db",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "Add libSQL support to your Astro site",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -65,21 +65,20 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@clack/prompts": "^1.0.1",
|
|
67
67
|
"@libsql/client": "^0.17.0",
|
|
68
|
-
"deep-diff": "^1.0.2",
|
|
69
68
|
"drizzle-orm": "^0.42.0",
|
|
69
|
+
"microdiff": "^1.5.0",
|
|
70
70
|
"nanoid": "^5.1.6",
|
|
71
71
|
"piccolore": "^0.1.3",
|
|
72
72
|
"yargs-parser": "^22.0.0",
|
|
73
73
|
"zod": "^4.3.6"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@types/deep-diff": "^1.0.5",
|
|
77
76
|
"@types/yargs-parser": "^21.0.3",
|
|
78
77
|
"cheerio": "1.2.0",
|
|
79
78
|
"expect-type": "^1.3.0",
|
|
80
79
|
"typescript": "^5.9.3",
|
|
81
80
|
"vite": "^7.3.1",
|
|
82
|
-
"astro": "6.0.
|
|
81
|
+
"astro": "6.0.6",
|
|
83
82
|
"astro-scripts": "0.0.14"
|
|
84
83
|
},
|
|
85
84
|
"scripts": {
|