-
Assuming I have an enum like this in the first migration file: #[derive(DeriveIden)]
pub enum Tag {
Table,
Id,
Name,
} I then create the table like this: manager
.create_table(
Table::create()
.table(Tag::Table)
.if_not_exists()
.col(
ColumnDef::new(Tag::Id)
.integer()
.not_null()
.auto_increment()
.primary_key(),
)
.col(ColumnDef::new(Tag::Name).string().not_null())
.to_owned(),
)
.await?; Now, in a future migration I want to add a new column, From the documentation I did not understand how I am supposed to handle this 🤔 In my mind each migration file was meant to be static, representing the DB in that point in time. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It depends on where you put the enum Tag? Usually we put the enums in the same file as the migration, so that each migration file is self-contained. |
Beta Was this translation helpful? Give feedback.
It depends on where you put the enum Tag? Usually we put the enums in the same file as the migration, so that each migration file is self-contained.