1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Save current game event to database for use in the match

This commit is contained in:
NG (Graham)
2025-07-22 21:36:24 -04:00
parent 0683de965b
commit fd11b8746b
11 changed files with 240 additions and 23 deletions

View File

@@ -0,0 +1,45 @@
use sea_orm_migration::prelude::*;
pub struct Migration;
impl MigrationName for Migration {
fn name(&self) -> &str {
"m20250722_000001_create_game_event_table"
}
}
#[async_trait::async_trait]
impl MigrationTrait for Migration {
// Define how to apply this migration: Create the Permissions table.
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.create_table(
Table::create()
.table(crate::schema::game_event::Entity)
.col(
ColumnDef::new(crate::schema::game_event::Column::Id)
.integer()
.not_null()
.auto_increment()
.primary_key(),
)
.col(ColumnDef::new(crate::schema::game_event::Column::CreationTime).big_integer().not_null())
.col(ColumnDef::new(crate::schema::game_event::Column::Map).string().not_null())
.col(ColumnDef::new(crate::schema::game_event::Column::Mode).string().not_null())
.col(ColumnDef::new(crate::schema::game_event::Column::Visibility).string().not_null())
.col(ColumnDef::new(crate::schema::game_event::Column::AutoHeal).boolean().not_null())
.col(ColumnDef::new(crate::schema::game_event::Column::Start).big_integer().not_null())
.col(ColumnDef::new(crate::schema::game_event::Column::End).big_integer().not_null())
.col(ColumnDef::new(crate::schema::game_event::Column::Variant).string().not_null())
.to_owned(),
)
.await
}
// Define how to rollback this migration: Drop the Permissions table.
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(crate::schema::game_event::Entity).to_owned())
.await
}
}

View File

@@ -9,6 +9,7 @@ mod m20250526_000001_add_garage_customisation;
mod m20250529_000001_create_sanction_table;
mod m20250713_000001_create_game_table;
mod m20250713_000002_create_player_table;
mod m20250722_000001_create_game_event_table;
pub struct Migrator;
@@ -25,6 +26,7 @@ impl MigratorTrait for Migrator {
Box::new(m20250529_000001_create_sanction_table::Migration),
Box::new(m20250713_000001_create_game_table::Migration),
Box::new(m20250713_000002_create_player_table::Migration),
Box::new(m20250722_000001_create_game_event_table::Migration),
]
}
}