migrations.rs (1062B)
1 #[cfg(feature = "native")] 2 use radroots_sql_core::SqlExecutor; 3 #[cfg(feature = "native")] 4 use radroots_sql_core::error::SqlError; 5 #[cfg(feature = "native")] 6 use radroots_sql_core::migrations::{Migration, migrations_run_all_down, migrations_run_all_up}; 7 8 #[cfg(feature = "native")] 9 pub static MIGRATIONS: &[Migration] = &[ 10 Migration { 11 name: "0000_init", 12 up_sql: include_str!("../migrations/0000_init.up.sql"), 13 down_sql: include_str!("../migrations/0000_init.down.sql"), 14 }, 15 Migration { 16 name: "0001_publish_workflows", 17 up_sql: include_str!("../migrations/0001_publish_workflows.up.sql"), 18 down_sql: include_str!("../migrations/0001_publish_workflows.down.sql"), 19 }, 20 ]; 21 22 #[cfg(feature = "native")] 23 pub fn run_all_up<E>(executor: &E) -> Result<(), SqlError> 24 where 25 E: SqlExecutor, 26 { 27 migrations_run_all_up(executor, MIGRATIONS) 28 } 29 30 #[cfg(feature = "native")] 31 pub fn run_all_down<E>(executor: &E) -> Result<(), SqlError> 32 where 33 E: SqlExecutor, 34 { 35 migrations_run_all_down(executor, MIGRATIONS) 36 }