add startup db migration in init hook
This commit is contained in:
parent
ce5a87c73a
commit
bc0782987a
0
src/routes/(app)/info/+page.svelte
Normal file
0
src/routes/(app)/info/+page.svelte
Normal file
0
src/routes/(app)/join/+page.svelte
Normal file
0
src/routes/(app)/join/+page.svelte
Normal file
0
src/routes/(app)/lore/+page.svelte
Normal file
0
src/routes/(app)/lore/+page.svelte
Normal file
0
src/routes/(app)/news/+page.svelte
Normal file
0
src/routes/(app)/news/+page.svelte
Normal file
10
src/routes/hooks.server.ts
Normal file
10
src/routes/hooks.server.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { dev } from '$app/environment';
|
||||
import { db } from '$lib/server/db';
|
||||
import type { ServerInit } from '@sveltejs/kit';
|
||||
import { migrate } from 'drizzle-orm/bun-sqlite/migrator';
|
||||
|
||||
export const init: ServerInit = async () => {
|
||||
if (!dev) {
|
||||
await migrate(db, { migrationsFolder: './drizzle' });
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user