Help with this error. "Can't find meta/_journal.json file"
Hi guys! I am new here and recently started learning how ORMs work and started with drizzle. I built my schema and managed to successfully generate a migration file for it. However, I am unable to actually migrate this to the database. I'm getting the following error
I have checked my migrate.js file but cannot understand what the problem might be
For context, I'm using the neon database server.
16 Replies
Can you provide code for migrate.js ?
Alright! Here's my code for migrate.js
Ok it look you dont configure drizzle.config.ts also i think you dont have already generate migrations
But I do have a drizzle.config.js file
and where you put the out folder ?
the migrations folder
change this
You already runned this ?
Okie one sec, i am making some schema changes. Also a doubt, is it okay to drop migrations?
yes, thats how i get the .sql file and the journal file. But when I run db:migrate, it says it can't find the _journal.json file
Yes because you was poiting to wrong path in migrate function
Ah it works now! Although I have schema problems it seems, but the migrate is working
Well, since schema.js is in the drizzle folder it self, i though simply writing migration as the pointed folder would be enough
No the path is referring to where node is executed
Ohh, I see. Well, it seems to be working fine now, so thnx!
And just for clean architectur keep drizzle dir only for generated files , put migration script and schema in separate dir i prefere "database" dir
Ah good idea. I was thinking abt it as well. Do you keep the db dir in the backend itself or create a separate dir for it(like client, db and backend)?
In backend