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::create() .table(User::Table) .if_not_exists() .col(pk_auto(User::Id)) .col(string(User::Name)) .col(string(User::Password)) .col(string(User::SessionToken)) .to_owned(), ) .await } async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { // Replace the sample below with your own migration scripts // todo!(); manager .drop_table(Table::drop().table(User::Table).to_owned()) .await } } #[derive(DeriveIden)] enum User { Table, Id, Name, Password, SessionToken, }