mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-11 17:26:32 +02:00
feat: Add database initialization script and default admin user seeding.
This commit is contained in:
1 parent
47872a994f
commit
086da9dfde
2 files changed
+12
-12
No files matched your search
@@ -63,6 +63,17 @@ async function main() {
|
||||
`);
|
||||
console.log("[DB Init] Table session_snapshots is verified/created.");
|
||||
|
||||
await tempPool.query(`
|
||||
CREATE TABLE IF NOT EXISTS "users" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"username" varchar(50) NOT NULL UNIQUE,
|
||||
"password_hash" text NOT NULL,
|
||||
"role" varchar(20) NOT NULL DEFAULT 'user',
|
||||
"created_at" timestamp DEFAULT now()
|
||||
);
|
||||
`);
|
||||
console.log("[DB Init] Table users is verified/created.");
|
||||
|
||||
await tempPool.end();
|
||||
console.log("[DB Init] Initialization successful. Exiting.");
|
||||
process.exit(0);
|
||||
|
||||
Reference in new issue
Block a user