From ca4e58a4e0a60d47277f21250fbc3275e3ac2923 Mon Sep 17 00:00:00 2001 From: AeCw Date: Mon, 23 Feb 2026 18:18:41 +0800 Subject: [PATCH] database migration --- astarcup/migration/src/m20260211_140546_user.rs | 14 +++++++------- .../migration/src/m20260211_140548_match_rooms.rs | 4 ++-- .../src/m20260211_140549_match_schedules.rs | 4 ++-- .../src/m20260211_140550_player_matchups.rs | 4 ++-- .../migration/src/m20260211_140551_messages.rs | 4 ++-- .../migration/src/m20260211_140552_map_comments.rs | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/astarcup/migration/src/m20260211_140546_user.rs b/astarcup/migration/src/m20260211_140546_user.rs index eb1c623..f2bc2e7 100644 --- a/astarcup/migration/src/m20260211_140546_user.rs +++ b/astarcup/migration/src/m20260211_140546_user.rs @@ -9,7 +9,7 @@ impl MigrationTrait for Migration { async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { manager.create_type( Type::create() - .as_enum(Alias::new("userState")) + .as_enum(Alias::new("user_state")) .values([Alias::new("active"),Alias::new("approved"),Alias::new("banned"),Alias::new("ignored")]) .to_owned(), ) @@ -17,7 +17,7 @@ impl MigrationTrait for Migration { manager .create_type( Type::create() - .as_enum(Alias::new("userGroup")) + .as_enum(Alias::new("user_group")) .values([Alias::new("player"),Alias::new("admin"),Alias::new("mapooler"),Alias::new("tester")]) .to_owned(), ) @@ -25,7 +25,7 @@ impl MigrationTrait for Migration { manager .create_type( Type::create() - .as_enum(Alias::new("matchStatus")) + .as_enum(Alias::new("match_status")) .values([Alias::new("available"), Alias::new("scheduled"), Alias::new("completed")]) .to_owned(), ) @@ -78,13 +78,13 @@ impl MigrationTrait for Migration { .col(ColumnDef::new(User::CountryRank).integer().null()) .col( ColumnDef::new(User::UserState) - .custom(Alias::new("userState")) + .custom(Alias::new("user_state")) .not_null() .default("active"), ) .col( ColumnDef::new(User::UserGroup) - .custom(Alias::new("userGroup")) + .custom(Alias::new("user_group")) .not_null() .default("player"), ) @@ -112,8 +112,8 @@ impl MigrationTrait for Migration { } async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { - manager.drop_type(Type::drop().name(Alias::new("userState")).to_owned()).await?; - manager.drop_type(Type::drop().name(Alias::new("userGroup")).to_owned()).await?; + manager.drop_type(Type::drop().name(Alias::new("user_state")).to_owned()).await?; + manager.drop_type(Type::drop().name(Alias::new("user_group")).to_owned()).await?; manager .drop_table(Table::drop().table(User::Table).to_owned()) .await diff --git a/astarcup/migration/src/m20260211_140548_match_rooms.rs b/astarcup/migration/src/m20260211_140548_match_rooms.rs index 315bdc2..94654dc 100644 --- a/astarcup/migration/src/m20260211_140548_match_rooms.rs +++ b/astarcup/migration/src/m20260211_140548_match_rooms.rs @@ -24,7 +24,7 @@ impl MigrationTrait for Migration { .col(ColumnDef::new(MatchRooms::MatchNumber).integer().not_null()) .col( ColumnDef::new(MatchRooms::Status) - .custom(Alias::new("matchStatus")) + .custom(Alias::new("match_status")) .default("available") .null(), ) @@ -49,7 +49,7 @@ impl MigrationTrait for Migration { } async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { - manager.drop_type(Type::drop().name(Alias::new("matchStatus")).to_owned()).await?; + manager.drop_type(Type::drop().name(Alias::new("match_status")).to_owned()).await?; manager .drop_table(Table::drop().table(MatchRooms::Table).to_owned()) .await diff --git a/astarcup/migration/src/m20260211_140549_match_schedules.rs b/astarcup/migration/src/m20260211_140549_match_schedules.rs index b0f5da2..f7722ca 100644 --- a/astarcup/migration/src/m20260211_140549_match_schedules.rs +++ b/astarcup/migration/src/m20260211_140549_match_schedules.rs @@ -43,7 +43,7 @@ impl MigrationTrait for Migration { .col(ColumnDef::new(MatchSchedules::BlueScore).integer().null()) .col( ColumnDef::new(MatchSchedules::Status) - .custom(Alias::new("matchStatus")) + .custom(Alias::new("match_status")) .default("available") .null(), ) @@ -81,7 +81,7 @@ impl MigrationTrait for Migration { async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { manager .drop_type( - Type::drop().name(Alias::new("matchStatus")).to_owned(), + Type::drop().name(Alias::new("match_status")).to_owned(), ) .await?; manager diff --git a/astarcup/migration/src/m20260211_140550_player_matchups.rs b/astarcup/migration/src/m20260211_140550_player_matchups.rs index dc32488..3fc47f4 100644 --- a/astarcup/migration/src/m20260211_140550_player_matchups.rs +++ b/astarcup/migration/src/m20260211_140550_player_matchups.rs @@ -43,7 +43,7 @@ impl MigrationTrait for Migration { ) .col( ColumnDef::new(PlayerMatchups::Status) - .custom(Alias::new("matchStatus")) + .custom(Alias::new("match_status")) .default("available") .not_null(), ) @@ -74,7 +74,7 @@ impl MigrationTrait for Migration { .await?; manager .drop_type( - Type::drop().name(Alias::new("matchStatus")).if_exists().to_owned(), + Type::drop().name(Alias::new("match_status")).if_exists().to_owned(), ) .await?; manager diff --git a/astarcup/migration/src/m20260211_140551_messages.rs b/astarcup/migration/src/m20260211_140551_messages.rs index 0fe0df2..44ef8d8 100644 --- a/astarcup/migration/src/m20260211_140551_messages.rs +++ b/astarcup/migration/src/m20260211_140551_messages.rs @@ -47,7 +47,7 @@ impl MigrationTrait for Migration { .col(ColumnDef::new(Messages::RelatedMatchupId).integer().null()) .col( ColumnDef::new(Messages::Status) - .custom(Alias::new("matchStatus")) + .custom(Alias::new("match_status")) .default("available") .not_null(), ) @@ -80,7 +80,7 @@ impl MigrationTrait for Migration { .await?; manager .drop_type( - Type::drop().name(Alias::new("matchStatus")).to_owned(), + Type::drop().name(Alias::new("match_status")).to_owned(), ) .await?; manager diff --git a/astarcup/migration/src/m20260211_140552_map_comments.rs b/astarcup/migration/src/m20260211_140552_map_comments.rs index 82c27f7..f0e88f0 100644 --- a/astarcup/migration/src/m20260211_140552_map_comments.rs +++ b/astarcup/migration/src/m20260211_140552_map_comments.rs @@ -23,7 +23,7 @@ impl MigrationTrait for Migration { .integer() .not_null(), ) - .col(ColumnDef::new(MapComments::OsuId).string().not_null()) + .col(ColumnDef::new(MapComments::OsuId).integer().not_null()) .foreign_key( ForeignKey::create() .from(MapComments::Table, MapComments::OsuId)