-
Notifications
You must be signed in to change notification settings - Fork 927
migrations
#1708
-
Hi, I am confused about migrations. I read in the docs that sqlc
executes migration:
However, sqlc executes the migration files in lexicographic order.
How can I do this? It's not part of the getting started guide, and It's not further explained. The generated code doesnt contain migration functions either.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
I finally figured it out!
Your schema file needs to be in your migrations folder. Eg for Goose:
sql/migrator
├── migrations
│ ├── 0_schema.sql
│ ├── 20230125153147_student_tooltop.sql
│ ├── 20230125155123_remove_tern_table.sql
...
Then in your sqlc.yaml
you specify the migrations directory instead of the schema file:
version: "2" sql: - schema: "sql/migrator/migrations" queries: "sql/queries" engine: "postgresql" ...
I agree that the docs need to be updated, as this wasn't at all obvious to me for months.
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment