Drizzle ORM: Why Schema-First Migrations Beat Push in SvelteKit Production Apps
A developer running multiple SvelteKit starter kits in production shares a practical decision rule for choosing between Drizzle ORM's two migration strategies. The code-first approach using drizzle-kit generate and migrate creates versioned SQL files with a full audit trail, while the push command syncs schema changes directly to a live database without any history. Push works well during early prototyping but poses serious risks in production, including silent destructive changes and no rollback mechanism. The schema-first workflow lets developers review, edit, and extend generated SQL before applying it, making it the safer choice once real data or collaborators are involved. The author also demonstrates running migrations automatically at app boot inside a createDb() function, rather than relying solely on a separate CI step.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in