Closed emidiotorre closed 1 month ago
Hi @emidiotorre, that makes sense. Can you try without the patch? It's currently only needed in some scenarios.
Note that iirc this won't work completely with inspect
either way -- you might need to manually tweak the inspected schema to use drizzle-postgis (like https://github.com/Schmavery/drizzle-postgis/blob/main/src/test/schema.ts).
Once your schema is in drizzle land, you can use drizzle-kit to manage/perform migrations without the patch as long as you don't use the gis.box2D
field type.
I can try to get another copy of the patch checked in, but it's a bit of a pain since we have to redo it everytime there's a drizzle-kit release. If you want, feel free to take a look at the latest patch we have checked in -- it's very simple and might even apply cleanly to the latest version.
Either way, let us know if you have any success or run into issues -- I can definitely make a new patch if it will unblock you!
Thanks for your help.
In the end I just needed to support the geometry column, only for multipolygon geometry, and I noticed that drizzle supports point geometry out of the box, so I treated the column as a varchar, and then tweaked the drizzle core function to parse the data correctly using wkx.
It is a hack but it's working, I can only read data and not write.
How could I do the same using this package? I tried to set this up but found it easier to do the fix myself.
Yeah, basically we use wkx to parse the datatype to geojson for you. You can see it on https://github.com/Schmavery/drizzle-postgis/blob/c0e2ded226ab27af4f7af7ad35f1394f3d38c220/src/test/schema.ts#L15
Basically if you use us then you don't need to directly work with wkx.
Then we have bindings to a few functions that you can use in your queries. Right now it's just a sampling of functions based on what I needed for my project, but they're not too hard to add.
Glad you worked out a fix! Feel free to reach out if you have problems :)
Thanks a lot for creating this package.
I am trying to build an app on top of an existing PostGIS database, i wanted to use the
drizzle-kit inspect
command to build the schema, from what i understand i need to patch drizzle-kit, but there's no patch for drizzle-kit@0.23.0.Furthermore I was looking for a simple setup example, but couldn't find any, it would be very useful to add a simple use case scenario in the readme.
Thanks again. If any support is needed for the development, I am available for contributions.