pgschema icon indicating copy to clipboard operation
pgschema copied to clipboard

Using in collaboration with drizzle-orm

Open maelp opened this issue 1 year ago • 4 comments

Very interesting project!

I'm using Drizzle ORM for my schema migration, I'm wondering if pgschema would bring any benefit? Could it be used in collaboration with the tool, or would it replace Drizzle migrations?

maelp avatar Sep 25 '25 16:09 maelp

Workflow

  1. Edit drizzle file locally.
  2. drizzle-kit export to export the full sql schema schema.sql
  3. pgschema plan --file schema.sql --db xxx, this use schema.sql as the desired schema, and pgschema then generates the plan to migrate the target db schema to schema.sql
  4. pgschema apply --plan plan.json to apply the migration

tianzhou avatar Sep 26 '25 15:09 tianzhou

@tianzhou really cool! And what advantage does this bring? is the pgschema migration "safer"?

maelp avatar Sep 26 '25 15:09 maelp

  1. Online DDL https://www.pgschema.com/workflow/online-ddl
  2. Concurrent migration detection https://www.pgschema.com/workflow/plan-review-apply#detect-concurrent-changes-with-fingerprinting

tianzhou avatar Sep 26 '25 15:09 tianzhou

Thanks!

maelp avatar Sep 26 '25 15:09 maelp