-
-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Less verbose migration #2084
Comments
Umm... is it actually possible to remove the pub fn col(&mut self, column: &mut ColumnDef) -> &mut Self; If we change column's type to |
tyt2y3
added a commit
to SeaQL/sea-query
that referenced
this issue
Jan 31, 2024
Done the change already. See the linked commit. |
This is now on master and use sea_orm_migration::schema::*; // where the good stuff are
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.create_table(
Table::create()
.table(Posts::Table)
.if_not_exists()
.col(pk_auto(Posts::Id))
.col(string(Posts::Title))
.col(string(Posts::Text))
.to_owned(),
)
.await
}
..
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://cprimozic.net/notes/posts/trying-out-sea-orm/
I am aware that some people think that migration syntax is too verbose. Luckily the clever folks at Loco designed something better!
https://github.com/loco-rs/loco/blob/master/examples/demo/migration/src/m20220101_000001_users.rs#L11
Reference: https://github.com/loco-rs/loco/blob/master/src/schema.rs
The text was updated successfully, but these errors were encountered: