Skip to content

SQL migrations are inconsistent when generating from schema.rs #4356

Closed Answered by weiznich
YievCkim asked this question in Q&A
Discussion options

You must be logged in to vote

There is no way for the CLI tool to know if a user really wants to use a auto incrementing ID there or not as there are also cases where this is not desired. In fact the CLI tool will more or less literally use the types as provided by the user. In that case this means if you write Int4 you get an Int4, if you write Serial you get Serial and so on. This is expected behaviour as we don't want to do any heavy processing at that point. After all we generate the SQL for you, but don't automatically apply the migration. The main reason for that is to give you as a user the possibility to modify the generated migration afterwards, for example by tweaking types or adding constraints.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@YievCkim
Comment options

@weiznich
Comment options

@YievCkim
Comment options

@weiznich
Comment options

@YievCkim
Comment options

Answer selected by YievCkim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants