zach
DTDrizzle Team
•Created by lordbinbash on 6/21/2024 in #help
Introspect poor accuracy (SQLite/Turso)
There’s probably a few more issues I can’t remember right now, but yeah I’m basically just fixing them with a few clean up commands after running introspection
4 replies
DTDrizzle Team
•Created by lordbinbash on 6/21/2024 in #help
Introspect poor accuracy (SQLite/Turso)
Yeah, my issues are with using Postgres though. The schemas generated with introspection contains javascript errors with unclosed brackets for varchar arrays, views still not getting generated, and foreign keys not added when connecting to remote databases
4 replies
DTDrizzle Team
•Created by Happer64Bit on 6/21/2024 in #help
is there a way to use Redis in drizzle
I don't believe so, at least according to their docs. What are you using Redis for that would require something like Drizzle? Are you just trying to cache sql query results while using Redis as middleware?
I use the
redis
npm library with a few simple get, set and delete functions that cover my use cases, using Redis as a caching database. I would imagine there's ways to set it up to cache your drizzle sql queries with helper functions, but you would lose all of the drizzle type-safe benefits.4 replies
DTDrizzle Team
•Created by sockthedev on 6/19/2024 in #help
Drizzle Kit: How to introspect Postgres DB without creating relations in generated schema?
I'd be interested in this as well, since the relations files generate with errors for large db's. Currently I just added the following to my
package.json
script to remove the relations files after introspection:
package.json
Add and modify && rm -rf src/clients/postgres/**/relations.ts
to target the directory you want to clean up after introspection2 replies
DTDrizzle Team
•Created by Cole on 2/13/2024 in #help
Pull schema changes without using drizzle migrations
/repo-name/apps/ts-app/src/clients/postgres/index.ts
9 replies
DTDrizzle Team
•Created by Cole on 2/13/2024 in #help
Pull schema changes without using drizzle migrations
/repo-name/apps/ts-app/src/clients/postgres/otherSchema/drizzle.config.ts
9 replies
DTDrizzle Team
•Created by Cole on 2/13/2024 in #help
Pull schema changes without using drizzle migrations
/repo-name/apps/ts-app/src/clients/postgres/public/drizzle.config.ts
9 replies
DTDrizzle Team
•Created by Cole on 2/13/2024 in #help
Pull schema changes without using drizzle migrations
My app directory structure is the following:
9 replies
DTDrizzle Team
•Created by Cole on 2/13/2024 in #help
Pull schema changes without using drizzle migrations
docker-compose.yml
9 replies
DTDrizzle Team
•Created by Cole on 2/13/2024 in #help
Pull schema changes without using drizzle migrations
package.json
9 replies
DTDrizzle Team
•Created by Cole on 2/13/2024 in #help
Pull schema changes without using drizzle migrations
Makefile
9 replies
DTDrizzle Team
•Created by Cole on 2/13/2024 in #help
Pull schema changes without using drizzle migrations
Hi, I just recently posted about a similar setup I'm using with flyway in the #kit-discussion channel. I'm currently continuing to use flyway to handle my migrations and have a Makefile that I use to run the db introspection after my flyway migrations run to update the drizzle types. I'm treating the generated introspection files as read-only and only update my sql in the flyway migrations. If you just have one schema in your database like
public
it should be pretty simple, if you're using multiple database schemas it can be a little more of a setup. I use multiple schemas and had to add a few adjustments to make it work, so for the example below let's say we have two database schemas, public
and otherSchema
. This setup allows you to have 1 or many schemas under the same database even though drizzle-kit doesn't support that out of the box well. This setup keeps schemas in their own namespace so they can even share same table names.
Here's my Makefile
that I use to run flyway migrations, then I run the drizzle db introspection to update the models, and then a few commands to clean up the drizzle migrations folders that I don't need as well as fix some of the errors drizzle-kit has on parsing.
So with this setup, I just run make migrate-db
after I change some sql in the flyway migration files, and it flows down to my app and keeps the drizzle schema types updated. You can add more sed
commands to fix any other types of parsing errors that come out of introspection.9 replies
DTDrizzle Team
•Created by zach on 2/3/2024 in #help
How can I read the table name and schema name of a created drizzle table instance?
Perfect, thank you!
4 replies