Best practices for Migration vs Schema.sql? #1928
Unanswered
petersng
asked this question in
Issue Triage
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, so I have a project that has multiple components separating into different packages that logically separate certain parts of the db schema. I have been setting up sqlc.yaml to have multiple schema.sql and query.sql for each of these components. However, we also have migration SQL files that encompass all schemas and updates across all these different components. This seems like a duplication of schema data, so I have been looking into trying just to have sqlc examine the migration files and not store schema.sql files in each component.
My question is, is it a common pattern to have both schema.sql and migration files? Does one typically use just migration files? A related question is if schema.sql should be treated like migration files (i.e. include ALTER, etc) or if should it represent the schema in the current version of the code.
Beta Was this translation helpful? Give feedback.
All reactions