mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Allow two or more people to load into the same multiplayer match #30
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub struct Migration;
|
||||
|
||||
impl MigrationName for Migration {
|
||||
fn name(&self) -> &str {
|
||||
"m20250713_000001_create_game_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::multiplayer_game::Entity)
|
||||
.col(
|
||||
ColumnDef::new(crate::schema::multiplayer_game::Column::Id)
|
||||
.integer()
|
||||
.not_null()
|
||||
.auto_increment()
|
||||
.primary_key(),
|
||||
)
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game::Column::CreationTime).big_integer().not_null())
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game::Column::Guid).big_integer().not_null())
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game::Column::Map).string().not_null())
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game::Column::Mode).string().not_null())
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game::Column::Visibility).string().not_null())
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game::Column::AutoHeal).boolean().not_null())
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game::Column::Variant).string().not_null())
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game::Column::IsComplete).boolean().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::multiplayer_game::Entity).to_owned())
|
||||
.await
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub struct Migration;
|
||||
|
||||
impl MigrationName for Migration {
|
||||
fn name(&self) -> &str {
|
||||
"m20250713_000002_create_player_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::multiplayer_game_player::Entity)
|
||||
.col(
|
||||
ColumnDef::new(crate::schema::multiplayer_game_player::Column::Id)
|
||||
.integer()
|
||||
.not_null()
|
||||
.auto_increment()
|
||||
.primary_key(),
|
||||
)
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_player::Column::UserId).integer().not_null())
|
||||
.foreign_key(
|
||||
ForeignKey::create()
|
||||
.name("fk-players-user_id")
|
||||
.from(crate::schema::multiplayer_game_player::Entity, crate::schema::multiplayer_game_player::Column::UserId)
|
||||
.to(crate::schema::user::Entity, crate::schema::user::Column::Id),
|
||||
)
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_player::Column::GameId).integer().not_null())
|
||||
.foreign_key(
|
||||
ForeignKey::create()
|
||||
.name("fk-players-game_id")
|
||||
.from(crate::schema::multiplayer_game_player::Entity, crate::schema::multiplayer_game_player::Column::GameId)
|
||||
.to(crate::schema::multiplayer_game::Entity, crate::schema::multiplayer_game::Column::Id),
|
||||
)
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_player::Column::CreationTime).big_integer().not_null())
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_player::Column::PlayerId).small_integer().not_null())
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_player::Column::Team).integer().not_null())
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_player::Column::Group).integer().null())
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_player::Column::IsClaimed).boolean().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::multiplayer_game_player::Entity).to_owned())
|
||||
.await
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ mod m20250424_000004_create_user_aux_table;
|
||||
mod m20250424_000005_create_campaign_tables;
|
||||
mod m20250526_000001_add_garage_customisation;
|
||||
mod m20250529_000001_create_sanction_table;
|
||||
mod m20250713_000001_create_game_table;
|
||||
mod m20250713_000002_create_player_table;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
@@ -21,6 +23,8 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20250424_000005_create_campaign_tables::Migration),
|
||||
Box::new(m20250526_000001_add_garage_customisation::Migration),
|
||||
Box::new(m20250529_000001_create_sanction_table::Migration),
|
||||
Box::new(m20250713_000001_create_game_table::Migration),
|
||||
Box::new(m20250713_000002_create_player_table::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user