database migration
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user