nixin-farm/nixin_farm_ssr/migration/src/m20241021_121806_services.rs

40 lines
961 B
Rust
Raw Normal View History

use loco_rs::schema::table_auto_tz;
use sea_orm_migration::{prelude::*, schema::*};
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.create_table(
table_auto_tz(Services::Table)
.col(pk_auto(Services::Id))
.col(string_uniq(Services::Name))
.col(text_null(Services::Description))
.col(text_null(Services::Configuration))
.to_owned(),
)
.await
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(Services::Table).to_owned())
.await
}
}
#[derive(DeriveIden)]
enum Services {
Table,
Id,
Name,
Description,
Configuration,
}