Skip to content
Open
Changes from all commits
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
8 changes: 7 additions & 1 deletion server/plugins/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import { migrate } from "drizzle-orm/postgres-js/migrator";
import { definePlugin } from "nitro";
import postgres from "postgres";

/**
* Set up the "workflow" database schema and apply Drizzle migrations from the project's drizzle folder.
*
* Ensures the PostgreSQL schema named "workflow" exists, runs migrations using the DATABASE_URL from the environment,
* logs progress, and closes the database connection. On migration failure the process exits with code 1.
*/
async function runMigrations() {
console.log("🔧 Setting up database schema...");

Expand Down Expand Up @@ -46,4 +52,4 @@ export default definePlugin(async () => {
}

// nitroApp.hooks.hook("request", async () => {});
});
});