//! Database migrations.

pub use sea_orm_migration::prelude::*;

mod m001_create_users;
mod m002_create_refresh_token_families;
mod m003_create_verification_tokens;
mod m004_create_billing;
{{#if has_organizations}}
mod m005_create_organizations;
mod m006_create_organization_members;
mod m007_add_admin_flag;
{{else}}
mod m005_add_admin_flag;
{{/if}}
mod m008_create_billing_plans;
mod m009_create_webhook_processed_events;

pub struct Migrator;

#[async_trait::async_trait]
impl MigratorTrait for Migrator {
    fn migrations() -> Vec<Box<dyn MigrationTrait>> {
        vec![
            Box::new(m001_create_users::Migration),
            Box::new(m002_create_refresh_token_families::Migration),
            Box::new(m003_create_verification_tokens::Migration),
            Box::new(m004_create_billing::Migration),
            {{#if has_organizations}}
            Box::new(m005_create_organizations::Migration),
            Box::new(m006_create_organization_members::Migration),
            Box::new(m007_add_admin_flag::Migration),
            {{else}}
            Box::new(m005_add_admin_flag::Migration),
            {{/if}}
            Box::new(m008_create_billing_plans::Migration),
            Box::new(m009_create_webhook_processed_events::Migration),
        ]
    }
}
