mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-11 17:26:32 +02:00
feat: Implement database initialization script and Drizzle ORM connection setup.
This commit is contained in:
1 parent
8902b535a8
commit
8fae4391a2
2 files changed
+17
-8
No files matched your search
+7
-1
@@ -6,7 +6,7 @@ const cwd = path.resolve(__dirname, '..'); // get app root when inside /scripts
|
||||
|
||||
async function main() {
|
||||
console.log("[DB Init] Starting database migration & initialization...");
|
||||
let connectionString = process.env.DATABASE_URL;
|
||||
let connectionString = "";
|
||||
|
||||
try {
|
||||
const CONFIG_PATH = path.join(cwd, "data", ".db-config.json");
|
||||
@@ -21,6 +21,12 @@ async function main() {
|
||||
console.error("[DB Init] Error reading .db-config.json", e);
|
||||
}
|
||||
|
||||
// Force environment variable if present (for Docker/DevOps consistency)
|
||||
if (process.env.DATABASE_URL) {
|
||||
connectionString = process.env.DATABASE_URL;
|
||||
console.log("[DB Init] Using environment variable DATABASE_URL (Priority).");
|
||||
}
|
||||
|
||||
if (!connectionString) {
|
||||
console.warn("[DB Init] No DATABASE_URL found in env or config. Skipping push.");
|
||||
process.exit(0);
|
||||
|
||||
Reference in new issue
Block a user