Drizzle TeamDT
Drizzle Team3y ago
14 replies
MrMendez

Migrate using Neon and Sveltekit

this is my code
import { pool } from '$lib/server/db';
import { drizzle } from 'drizzle-orm/neon-serverless';
import { migrate } from 'drizzle-orm/neon-serverless/migrator';
const db = drizzle(pool);

// this will automatically run needed migrations on the database
await migrate(db, { migrationsFolder: './migrations' });

pnpm script "migrate:push": "vite-node --options.transformMode.ssr='/.*/' ./src/lib/migrate.ts",

my connection setup
import { Pool, neon, neonConfig } from '@neondatabase/serverless';
export const pool = new Pool({ connectionString: DB_CONNECTION_STRING });
export const http = neon(DB_CONNECTION_STRING);


and the error:
Error: The required file "meta/_journal.json" could not be found.

It seems like the "meta/_journal.json" file is missing or not located where the system expects it to be. This file is crucial for the migration process and the system cannot proceed without it.

Location of the error:
- File: /.../node_modules/drizzle-orm/migrator.mjs
- Line: 21
- Method: readMigrationFiles

Stack trace:
1. readMigrationFiles at migrator.ts:40:9
2. Module.migrate at neon-serverless/migrator.ts:9:21
3. /home/mrmendez/Projects/skymanager/src/lib/migrate.ts:7:7
4. ViteNodeRunner.runModule at vite-node/dist/client.mjs:342:5
5. ViteNodeRunner.directRequest at vite-node/dist/client.mjs:326:5
6. ViteNodeRunner.cachedRequest at vite-node/dist/client.mjs:189:14
7. ViteNodeRunner.executeFile at vite-node/dist/client.mjs:161:12
8. CAC.run at vite-node/dist/cli.mjs:91:5
Was this page helpful?