mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Implement most of clans functionality; close #89
This commit is contained in:
1 parent
e120b945c8
commit
f0cca11d3c
43 files changed
+2605
-26
No files matched your search
@@ -23,7 +23,7 @@ impl MigrationTrait for Migration {
|
||||
.auto_increment()
|
||||
.primary_key(),
|
||||
)
|
||||
.col(ColumnDef::new(crate::schema::factory::vehicle::Column::CreationTime).big_integer().not_null())
|
||||
.col(ColumnDef::new(crate::schema::friend::Column::CreationTime).big_integer().not_null())
|
||||
.col(ColumnDef::new(crate::schema::friend::Column::FriendSource).integer().not_null())
|
||||
.foreign_key(
|
||||
ForeignKey::create()
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub struct Migration;
|
||||
|
||||
impl MigrationName for Migration {
|
||||
fn name(&self) -> &str {
|
||||
"m20260221_000001_create_clan_table"
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
// Define how to apply this migration: Create the Clans table.
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
.table(crate::schema::clan::Entity)
|
||||
.col(
|
||||
ColumnDef::new(crate::schema::clan::Column::Id)
|
||||
.integer()
|
||||
.not_null()
|
||||
.auto_increment()
|
||||
.primary_key(),
|
||||
)
|
||||
.col(ColumnDef::new(crate::schema::clan::Column::CreationTime).big_integer().not_null())
|
||||
.col(ColumnDef::new(crate::schema::clan::Column::Name).string().not_null())
|
||||
.col(ColumnDef::new(crate::schema::clan::Column::Description).string().not_null())
|
||||
.col(ColumnDef::new(crate::schema::clan::Column::Variant).string().not_null())
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
// Define how to rollback this migration: Drop the Clans table.
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(crate::schema::clan::Entity).to_owned())
|
||||
.await
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub struct Migration;
|
||||
|
||||
impl MigrationName for Migration {
|
||||
fn name(&self) -> &str {
|
||||
"m20260221_000002_create_clan_member_table"
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
// Define how to apply this migration: Create the Clan Members table.
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
.table(crate::schema::clan_member::Entity)
|
||||
.col(
|
||||
ColumnDef::new(crate::schema::clan_member::Column::Id)
|
||||
.integer()
|
||||
.not_null()
|
||||
.auto_increment()
|
||||
.primary_key(),
|
||||
)
|
||||
.col(ColumnDef::new(crate::schema::clan_member::Column::CreationTime).big_integer().not_null())
|
||||
.col(ColumnDef::new(crate::schema::clan_member::Column::UserId).integer().not_null())
|
||||
.foreign_key(
|
||||
ForeignKey::create()
|
||||
.name("fk-clan_members-user_id")
|
||||
.from(crate::schema::clan_member::Entity, crate::schema::clan_member::Column::UserId)
|
||||
.to(crate::schema::user::Entity, crate::schema::user::Column::Id),
|
||||
)
|
||||
.col(ColumnDef::new(crate::schema::clan_member::Column::ClanId).integer().not_null())
|
||||
.foreign_key(
|
||||
ForeignKey::create()
|
||||
.name("fk-clan_members-clan_id")
|
||||
.from(crate::schema::clan_member::Entity, crate::schema::clan_member::Column::ClanId)
|
||||
.to(crate::schema::clan::Entity, crate::schema::clan::Column::Id),
|
||||
)
|
||||
.col(ColumnDef::new(crate::schema::clan_member::Column::Rank).string().not_null())
|
||||
.col(ColumnDef::new(crate::schema::clan_member::Column::Status).string().not_null())
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
// Define how to rollback this migration: Drop the Clan Members table.
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(crate::schema::clan_member::Entity).to_owned())
|
||||
.await
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ mod m20251228_000001_create_score_table;
|
||||
#[cfg(feature = "factory")]
|
||||
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;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
@@ -39,6 +41,8 @@ impl MigratorTrait for Migrator {
|
||||
#[cfg(feature = "factory")]
|
||||
Box::new(m20260126_000001_create_factory_vehicle_table::Migration),
|
||||
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),
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user