what does loco offers

This commit is contained in:
Priec
2026-05-15 22:31:26 +02:00
parent 0c25fa5d11
commit 8b7f883f14
22 changed files with 731 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
pub use sea_orm_migration::prelude::*;
mod m20220101_000001_users;
mod m20260515_162423_courts;
pub struct Migrator;
#[async_trait::async_trait]
@@ -10,7 +11,8 @@ impl MigratorTrait for Migrator {
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
vec![
Box::new(m20220101_000001_users::Migration),
Box::new(m20260515_162423_courts::Migration),
// inject-above (do not remove this comment)
]
}
}
}

View File

@@ -0,0 +1,27 @@
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, "courts",
&[
("id", ColType::PkAuto),
("name", ColType::StringNull),
("surface", ColType::StringNull),
("indoor", ColType::BooleanNull),
],
&[
]
).await
}
async fn down(&self, m: &SchemaManager) -> Result<(), DbErr> {
drop_table(m, "courts").await
}
}