@astrojs/db 0.14.5 → 0.14.6
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.
|
@@ -33,7 +33,7 @@ async function cmd({
|
|
|
33
33
|
ASTRO_DATABASE_FILE,
|
|
34
34
|
new URL(DB_PATH, astroConfig.root).href
|
|
35
35
|
);
|
|
36
|
-
const db = createLocalDatabaseClient({ dbUrl,
|
|
36
|
+
const db = createLocalDatabaseClient({ dbUrl, enableTransactions: dbInfo.type === "libsql" });
|
|
37
37
|
const result = await db.run(sql.raw(query));
|
|
38
38
|
console.log(result);
|
|
39
39
|
}
|
|
@@ -140,7 +140,7 @@ async function recreateTables({ tables, root }) {
|
|
|
140
140
|
const dbInfo = getRemoteDatabaseInfo();
|
|
141
141
|
const { ASTRO_DATABASE_FILE } = getAstroEnv();
|
|
142
142
|
const dbUrl = normalizeDatabaseUrl(ASTRO_DATABASE_FILE, new URL(DB_PATH, root).href);
|
|
143
|
-
const db = createLocalDatabaseClient({ dbUrl,
|
|
143
|
+
const db = createLocalDatabaseClient({ dbUrl, enableTransactions: dbInfo.type === "libsql" });
|
|
144
144
|
const setupQueries = [];
|
|
145
145
|
for (const [name, table] of Object.entries(tables.get() ?? {})) {
|
|
146
146
|
const dropQuery = sql.raw(`DROP TABLE IF EXISTS ${sqlite.escapeName(name)}`);
|
|
@@ -2,7 +2,7 @@ import type { LibSQLDatabase } from 'drizzle-orm/libsql';
|
|
|
2
2
|
import { type SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
|
|
3
3
|
type LocalDbClientOptions = {
|
|
4
4
|
dbUrl: string;
|
|
5
|
-
|
|
5
|
+
enableTransactions: boolean;
|
|
6
6
|
};
|
|
7
7
|
export declare function createLocalDatabaseClient(options: LocalDbClientOptions): LibSQLDatabase;
|
|
8
8
|
type RemoteDbClientOptions = {
|
|
@@ -17,7 +17,7 @@ function createLocalDatabaseClient(options) {
|
|
|
17
17
|
const url = isWebContainer ? "file:content.db" : options.dbUrl;
|
|
18
18
|
const client = createClient({ url });
|
|
19
19
|
const db = drizzleLibsql(client);
|
|
20
|
-
if (!options.
|
|
20
|
+
if (!options.enableTransactions) {
|
|
21
21
|
applyTransactionNotSupported(db);
|
|
22
22
|
}
|
|
23
23
|
return db;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/db",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.6",
|
|
4
4
|
"description": "Add libSQL and Astro Studio support to your Astro site",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -72,18 +72,18 @@
|
|
|
72
72
|
"open": "^10.1.0",
|
|
73
73
|
"prompts": "^2.4.2",
|
|
74
74
|
"yargs-parser": "^21.1.1",
|
|
75
|
-
"yocto-spinner": "^0.1.
|
|
76
|
-
"zod": "^3.
|
|
77
|
-
"@astrojs/studio": "0.1.
|
|
75
|
+
"yocto-spinner": "^0.1.2",
|
|
76
|
+
"zod": "^3.24.1",
|
|
77
|
+
"@astrojs/studio": "0.1.4"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/deep-diff": "^1.0.5",
|
|
81
81
|
"@types/prompts": "^2.4.9",
|
|
82
82
|
"@types/yargs-parser": "^21.0.3",
|
|
83
83
|
"cheerio": "1.0.0",
|
|
84
|
-
"typescript": "^5.
|
|
85
|
-
"vite": "^6.0.
|
|
86
|
-
"astro": "5.1.
|
|
84
|
+
"typescript": "^5.7.3",
|
|
85
|
+
"vite": "^6.0.9",
|
|
86
|
+
"astro": "5.1.8",
|
|
87
87
|
"astro-scripts": "0.0.14"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|