32 lines
1.1 KiB
Rust
32 lines
1.1 KiB
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> {
|
||
// Buyer-selectable display currencies. EUR is the base/transaction
|
||
// currency and is NOT stored here; each row is an alternative the buyer
|
||
// can switch to, whose prices are the EUR price recalculated at
|
||
// `rate_e4` (units of this currency per 1 EUR, scaled ×10000). For now
|
||
// the only row is CZK, seeded by `initializers::currency_seeder`.
|
||
create_table(m, "currencies",
|
||
&[
|
||
("id", ColType::PkAuto),
|
||
("code", ColType::StringUniq),
|
||
("symbol", ColType::String),
|
||
("rate_e4", ColType::BigIntegerWithDefault(10_000)),
|
||
("enabled", ColType::BooleanWithDefault(true)),
|
||
],
|
||
&[
|
||
]
|
||
).await
|
||
}
|
||
|
||
async fn down(&self, m: &SchemaManager) -> Result<(), DbErr> {
|
||
drop_table(m, "currencies").await
|
||
}
|
||
}
|