Migrate using Neon and Sveltekit
this is my code
pnpm script
"migrate:push": "vite-node --options.transformMode.ssr='/.*/' ./src/lib/migrate.ts",
my connection setup
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:58 Replies
Did you generate a migration prior to try to run it?
yes
"migrate:gen": "drizzle-kit generate:pg --schema=./src/lib/migrations/schema.ts"
The other thing would be to check it you're providing the correct directory path in the config
![No description](https://cdn.answeroverflow.com/1149421109771509821/image.png)
Don't you need:
?
nop, ./migrations is the right relative path, but either way if i use ./src/lib/migrations still does not work
also, the type error on db is this:
Error: Type Mismatch
The "NeonDatabase<Record<string, never>>" type is not compatible with "NeonDatabase<Record<string, unknown>>". The discrepancy is rooted in the compatibility of '$with(...).as' between these types.
Here are the details:
- The 'getSQL()' return types are incompatible between the versions of drizzle-orm you are using (0.28.5 and 0.28.6).
- The 'shouldInlineParams' property has different declarations in these versions.
- The Typescript compiler detected this as error 2345, indicating a type assignment issue.
Root Cause:
It seems like you are using two different versions of drizzle-orm library. The type declarations in version 0.28.5 don't match with those in version 0.28.6, leading to this conflict.
I would delete node_modules and install everything again
nop 🥲
wait
never mind, yea same error, delete all the meta and sql file and tried generating them again too, still have the same error:
i kind of found out the problem
will update soon