create-guren-app 1.8.1 → 1.8.3
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/dist/cli.js
CHANGED
|
@@ -1850,14 +1850,38 @@ async function resolveSchema(destination, driver) {
|
|
|
1850
1850
|
}
|
|
1851
1851
|
function generateDrizzleConfig(driver) {
|
|
1852
1852
|
const { url, dialect } = DATABASE_DEFAULTS[driver];
|
|
1853
|
-
|
|
1853
|
+
const preamble = driver !== "sqlite" ? "" : `
|
|
1854
|
+
const filename = process.env.DATABASE_URL ?? '${url}'
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* DATABASE_URL is read by two different SQLite implementations that disagree
|
|
1858
|
+
* about URI filenames: the app opens it with \`bun:sqlite\`, which honours them,
|
|
1859
|
+
* while drizzle-kit opens it with \`node:sqlite\`, which does not. So \`file:\` is
|
|
1860
|
+
* not a shared spelling of anything \u2014 \`file:local.db\` migrates the app into
|
|
1861
|
+
* \`local.db\` and drizzle-kit into a file *named* \`file:local.db\`. The safe set
|
|
1862
|
+
* is what both agree on: plain paths, and \`:memory:\`.
|
|
1863
|
+
*
|
|
1864
|
+
* The scheme must be two characters or more, since no registered scheme is one
|
|
1865
|
+
* letter while \`C:/data/app.db\` is a Windows drive path.
|
|
1866
|
+
*/
|
|
1867
|
+
const uriScheme = /^([a-z][a-z0-9+.-]+):/i.exec(filename)
|
|
1854
1868
|
|
|
1869
|
+
if (uriScheme) {
|
|
1870
|
+
throw new Error(
|
|
1871
|
+
\`DATABASE_URL must be a plain file path for SQLite, but starts with "\${uriScheme[1]}:". \` +
|
|
1872
|
+
'Point it at a file such as ${url}, or use ":memory:".',
|
|
1873
|
+
)
|
|
1874
|
+
}
|
|
1875
|
+
`;
|
|
1876
|
+
const credentialUrl = driver === "sqlite" ? "filename" : `process.env.DATABASE_URL ?? '${url}'`;
|
|
1877
|
+
return `import { defineConfig } from 'drizzle-kit'
|
|
1878
|
+
${preamble}
|
|
1855
1879
|
export default defineConfig({
|
|
1856
1880
|
schema: './db/schema.ts',
|
|
1857
1881
|
out: './db/migrations',
|
|
1858
1882
|
dialect: '${dialect}',
|
|
1859
1883
|
dbCredentials: {
|
|
1860
|
-
url:
|
|
1884
|
+
url: ${credentialUrl},
|
|
1861
1885
|
},
|
|
1862
1886
|
})
|
|
1863
1887
|
`;
|
package/package.json
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"test": "bun test"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@guren/cli": "^2.6.
|
|
22
|
-
"@guren/core": "^1.
|
|
23
|
-
"@guren/orm": "^2.
|
|
21
|
+
"@guren/cli": "^2.6.2",
|
|
22
|
+
"@guren/core": "^1.7.0",
|
|
23
|
+
"@guren/orm": "^2.5.0",
|
|
24
24
|
"drizzle-orm": "1.0.0-rc.4"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"db:seed": "bunx guren db:seed"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@guren/cli": "^2.6.
|
|
23
|
-
"@guren/core": "^1.
|
|
22
|
+
"@guren/cli": "^2.6.2",
|
|
23
|
+
"@guren/core": "^1.7.0",
|
|
24
24
|
"@guren/inertia-client": "^1.1.1",
|
|
25
|
-
"@guren/orm": "^2.
|
|
25
|
+
"@guren/orm": "^2.5.0",
|
|
26
26
|
"@inertiajs/react": "^3.6.1",
|
|
27
27
|
"drizzle-orm": "1.0.0-rc.4",
|
|
28
28
|
"react": "^19.0.0",
|