mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Add basic currency support and plumb multiplayer rewards screen #70
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub struct Migration;
|
||||
|
||||
impl MigrationName for Migration {
|
||||
fn name(&self) -> &str {
|
||||
"m20251228_000001_create_score_table"
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
// Define how to apply this migration: Create the Scores table.
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
.table(crate::schema::multiplayer_game_score::Entity)
|
||||
.col(
|
||||
ColumnDef::new(crate::schema::multiplayer_game_score::Column::Id)
|
||||
.integer()
|
||||
.not_null()
|
||||
.auto_increment()
|
||||
.primary_key(),
|
||||
)
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::PlayerId).integer().not_null())
|
||||
.foreign_key(
|
||||
ForeignKey::create()
|
||||
.name("fk-scores-player_id")
|
||||
.from(crate::schema::multiplayer_game_score::Entity, crate::schema::multiplayer_game_score::Column::PlayerId)
|
||||
.to(crate::schema::multiplayer_game_player::Entity, crate::schema::multiplayer_game_player::Column::Id),
|
||||
)
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::CreationTime).big_integer().not_null())
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::IsClaimed).boolean().default(false))
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::Kills).integer().default(0))
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::Deaths).integer().default(0))
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::Assists).integer().default(0))
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::HealAssists).integer().default(0))
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::Healed).integer().default(0))
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::ReceivedHealed).integer().default(0))
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::Damaged).integer().default(0))
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::ReceivedDamaged).integer().default(0))
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::Crystals).integer().default(0))
|
||||
.col(ColumnDef::new(crate::schema::multiplayer_game_score::Column::Total).integer().default(0))
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
// Define how to rollback this migration: Drop the Scores table.
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(crate::schema::multiplayer_game_score::Entity).to_owned())
|
||||
.await
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ mod m20250713_000002_create_player_table;
|
||||
mod m20250722_000001_create_game_event_table;
|
||||
mod m20250816_000001_add_fake_players;
|
||||
mod m20250918_000001_add_player_variant;
|
||||
mod m20251228_000001_create_score_table;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
@@ -31,6 +32,7 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20250722_000001_create_game_event_table::Migration),
|
||||
Box::new(m20250816_000001_add_fake_players::Migration),
|
||||
Box::new(m20250918_000001_add_player_variant::Migration),
|
||||
Box::new(m20251228_000001_create_score_table::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user