Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c47c3c158 | ||
|
|
2650d325ec |
No files matched your search
@@ -8,8 +8,7 @@
|
||||
// drizzle-kit (`pnpm db:generate` / studio / introspect) is draft/browse tooling only.
|
||||
//
|
||||
// Usage: pnpm db:schema:generate
|
||||
import "dotenv/config";
|
||||
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
@@ -31,6 +30,13 @@ const ROOT = resolve(__dirname, "..");
|
||||
const SCHEMA_TS = resolve(ROOT, "src/db/schema.ts");
|
||||
const OUT = SCHEMA_TS;
|
||||
|
||||
// Load .env like the TS scripts do (process.loadEnvFile never overrides
|
||||
// variables already present in the shell).
|
||||
for (const name of [".env.local", ".env"]) {
|
||||
const file = resolve(ROOT, name);
|
||||
if (existsSync(file)) process.loadEnvFile(file);
|
||||
}
|
||||
|
||||
// ---------- Parse existing Drizzle schema (naming source of truth) ----------
|
||||
const schemaSource = readFileSync(SCHEMA_TS, "utf-8");
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user