mirror of
https://example.com
synced 2024-11-27 07:56:40 +09:00
use iden enum
This commit is contained in:
parent
d28f74b513
commit
3010ac9e74
1 changed files with 16 additions and 2 deletions
|
@ -16,13 +16,19 @@ pub struct Migration;
|
||||||
impl MigrationTrait for Migration {
|
impl MigrationTrait for Migration {
|
||||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||||
manager
|
manager
|
||||||
.drop_table(Table::drop().table(Alias::new("reversi_game")).to_owned())
|
.drop_table(
|
||||||
|
Table::drop()
|
||||||
|
.if_exists()
|
||||||
|
.table(ReversiGame::Table)
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
manager
|
manager
|
||||||
.drop_table(
|
.drop_table(
|
||||||
Table::drop()
|
Table::drop()
|
||||||
.table(Alias::new("reversi_matching"))
|
.if_exists()
|
||||||
|
.table(ReversiMatching::Table)
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -379,6 +385,14 @@ enum Webhook {
|
||||||
Id,
|
Id,
|
||||||
On,
|
On,
|
||||||
}
|
}
|
||||||
|
#[derive(Iden)]
|
||||||
|
enum ReversiGame {
|
||||||
|
Table,
|
||||||
|
}
|
||||||
|
#[derive(Iden)]
|
||||||
|
enum ReversiMatching {
|
||||||
|
Table,
|
||||||
|
}
|
||||||
|
|
||||||
fn select_query<T: Iden + 'static>(table: T, id: T, col: T) -> String {
|
fn select_query<T: Iden + 'static>(table: T, id: T, col: T) -> String {
|
||||||
Query::select()
|
Query::select()
|
||||||
|
|
Loading…
Reference in a new issue