33 lines
941 B
Rust
33 lines
941 B
Rust
use loco_rs::schema::*;
|
|
use sea_orm_migration::prelude::*;
|
|
|
|
#[derive(DeriveMigrationName)]
|
|
pub struct Migration;
|
|
|
|
#[async_trait::async_trait]
|
|
impl MigrationTrait for Migration {
|
|
async fn up(&self, m: &SchemaManager) -> Result<(), DbErr> {
|
|
create_table(
|
|
m,
|
|
"reviews",
|
|
&[
|
|
("id", ColType::PkAuto),
|
|
("title", ColType::StringNull),
|
|
("review_type", ColType::StringNull),
|
|
("rating", ColType::IntegerNull),
|
|
("review_date", ColType::StringNull),
|
|
("status", ColType::StringNull),
|
|
("description", ColType::StringNull),
|
|
("tags", ColType::StringNull),
|
|
("cover", ColType::StringNull),
|
|
],
|
|
&[],
|
|
)
|
|
.await
|
|
}
|
|
|
|
async fn down(&self, m: &SchemaManager) -> Result<(), DbErr> {
|
|
drop_table(m, "reviews").await
|
|
}
|
|
}
|