mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Implement lobby parts of custom games #38
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub struct Migration;
|
||||
|
||||
impl MigrationName for Migration {
|
||||
fn name(&self) -> &str {
|
||||
"m20260317_000001_add_game_overrides"
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
// Define how to apply this migration: Add game overrides columns
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(crate::schema::multiplayer_game::Entity)
|
||||
.add_column(ColumnDef::new(crate::schema::multiplayer_game::Column::Overrides).string().not_null().default("".to_owned()))
|
||||
.to_owned()
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
// Define how to rollback this migration: Drop the added column
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(crate::schema::multiplayer_game::Entity)
|
||||
.drop_column(crate::schema::multiplayer_game::Column::Overrides)
|
||||
.to_owned()
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ mod m20260126_000001_create_factory_vehicle_table;
|
||||
mod m20260215_000001_create_friend_table;
|
||||
mod m20260221_000001_create_clan_table;
|
||||
mod m20260221_000002_create_clan_member_table;
|
||||
mod m20260317_000001_add_game_overrides;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
@@ -43,6 +44,7 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20260215_000001_create_friend_table::Migration),
|
||||
Box::new(m20260221_000001_create_clan_table::Migration),
|
||||
Box::new(m20260221_000002_create_clan_member_table::Migration),
|
||||
Box::new(m20260317_000001_add_game_overrides::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ pub struct Model {
|
||||
pub auto_heal: bool,
|
||||
pub variant: GameType,
|
||||
pub is_complete: bool,
|
||||
pub overrides: String, // JSON-encoded oj_rc_ore::persist::user::lobby::CustomGameConfig
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
|
||||
Reference in New Issue
Block a user