N
Neon3w ago
sunny-green

How to reconcile local schema with a remote schema that has an extension?

Hello! I have a database that I installed the postgis extension on. It added some views and tables that do not exist in my local schema so I've attempted a drizzle-kit pull to pull down the remote schema and have parity. It "fails" and gives this error but does seem to pull down the remote schema.
Error: ENOENT: no such file or directory, open '...\drizzle\meta\_journal.json'
Error: ENOENT: no such file or directory, open '...\drizzle\meta\_journal.json'
The remote schema it pulls has "unknown" column types for the extension views and it does not let me perform a db:push with it. Trying to do a db:push with my current local schema fails because it attempts to truncate the extension views, which the extension requires. I can drop the extension, and all related tables, but that seems very extreme especially since I'll just have to add it right back. Is there some way to get the correct table/view definitions for the extension so that my db:push doesn't attempt to truncate needlessly?
2 Replies
wise-white
wise-white3w ago
Hey! You should add the PostGIS extention creation to your migrations using a --generate custom : https://orm.drizzle.team/docs/guides/postgis-geometry-point then, do a run migrate
Drizzle ORM - PostGIS geometry point
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
sunny-green
sunny-greenOP3w ago
Is there any documentation on creating the migrations files/folder structure? Running the command 'npx drizzle-kit generate --custom' gives the same error as above, it can't find the _journal.json file which doesn't exist because I assume I didn't setup something properly originally. https://orm.drizzle.team/docs/migrations doesn't seem to be much help for setup. It just feels like I'm in a catch-22 right now, not really sure what to do Wait maybe I just needed to change the path of my out folder in my drizzle.config, might be working now

Did you find this page helpful?