use iden enum

This commit is contained in:
Namekuji 2023-06-01 04:24:45 -04:00
parent d28f74b513
commit 3010ac9e74
No known key found for this signature in database
GPG Key ID: B541BD6E646CABC7
1 changed files with 16 additions and 2 deletions

View File

@ -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()