Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ASTRO_DATABASE_FILE work with file paths #10631

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use pathToFileURL
  • Loading branch information
matthewp committed Apr 1, 2024
commit 802abb4e35bc98cad5d0f2d1e194078097a2ab79
3 changes: 2 additions & 1 deletion packages/db/src/runtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from 'drizzle-orm/sqlite-core';
import { type DBColumn, type DBTable } from '../core/types.js';
import { type SerializedSQL, isSerializedSQL } from './types.js';
import { pathToFileURL } from 'url';

export type { Table } from './types.js';
export { createRemoteDatabaseClient, createLocalDatabaseClient } from './db-client.js';
Expand Down Expand Up @@ -138,7 +139,7 @@ export function normalizeDatabaseUrl(envDbUrl: string | undefined, defaultDbUrl:
if(envDbUrl.startsWith('file://')) {
return envDbUrl;
}
return new URL(envDbUrl, process.cwd()).toString();
return new URL(envDbUrl, pathToFileURL(process.cwd())).toString();
} else {
// This is going to be a file URL always,
return defaultDbUrl;
Expand Down
Loading