mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-05 19:11:06 +00:00
Merge pull request #112 from EETagent/only_for_debug_migration
(backend) create admin only on debug || test
This commit is contained in:
commit
69ff814928
1 changed files with 19 additions and 6 deletions
|
|
@ -14,17 +14,30 @@ pub struct Migrator;
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl MigratorTrait for Migrator {
|
impl MigratorTrait for Migrator {
|
||||||
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
|
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
|
||||||
vec![
|
let mut migrations: Vec<Box<dyn MigrationTrait>> = vec![
|
||||||
Box::new(m20221024_111310_create_admin::Migration),
|
Box::new(m20221024_111310_create_admin::Migration),
|
||||||
Box::new(m20221024_121621_create_candidate::Migration),
|
Box::new(m20221024_121621_create_candidate::Migration),
|
||||||
Box::new(m20221024_124701_create_parent::Migration),
|
Box::new(m20221024_124701_create_parent::Migration),
|
||||||
Box::new(m20221024_134454_insert_sample_admin::Migration::default()),
|
|
||||||
Box::new(m20221025_154422_create_session::Migration),
|
Box::new(m20221025_154422_create_session::Migration),
|
||||||
Box::new(m20221027_194728_session_create_user_fk::Migration),
|
|
||||||
Box::new(m20221112_112212_create_parent_candidate_fk::Migration),
|
|
||||||
Box::new(m20221221_162232_create_admin_session::Migration),
|
Box::new(m20221221_162232_create_admin_session::Migration),
|
||||||
Box::new(m20221028_194728_session_create_admin_fk::Migration),
|
];
|
||||||
|
|
||||||
]
|
if cfg!(debug_assertions) || cfg!(test) {
|
||||||
|
migrations.push(Box::new(
|
||||||
|
m20221024_134454_insert_sample_admin::Migration::default(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if !cfg!(test) {
|
||||||
|
migrations.push(Box::new(m20221027_194728_session_create_user_fk::Migration));
|
||||||
|
migrations.push(Box::new(
|
||||||
|
m20221112_112212_create_parent_candidate_fk::Migration,
|
||||||
|
));
|
||||||
|
migrations.push(Box::new(
|
||||||
|
m20221028_194728_session_create_admin_fk::Migration,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
migrations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue