Skip to content

Commit

Permalink
Merge pull request #20 from fan-tastic-z/fix-sea-orm_migration_error
Browse files Browse the repository at this point in the history
  • Loading branch information
fankaiLiu authored Dec 11, 2023
2 parents 820e244 + 4add557 commit 48da3c4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/template/migration/src/m20220101_000001_create_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,35 @@ impl MigrationTrait for Migration {
manager
.create_table(
Table::create()
.table(User::Table)
.table(Users::Table)
.if_not_exists()
.col(
ColumnDef::new(User::Id)
ColumnDef::new(Users::Id)
.string()
.not_null()
.primary_key(),
)
.col(
ColumnDef::new(User::Username)
ColumnDef::new(Users::Username)
.string()
.not_null()
.unique_key(),
)
.col(ColumnDef::new(User::Password).string().not_null())
.col(ColumnDef::new(Users::Password).string().not_null())
.to_owned(),
)
.await
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(User::Table).to_owned())
.drop_table(Table::drop().table(Users::Table).to_owned())
.await
}
}

#[derive(Iden)]
enum User {
enum Users {
Table,
Id,
Username,
Expand Down

0 comments on commit 48da3c4

Please sign in to comment.