backbone-banking 0.7.1

Cash & bank — bank/account master, statement import, reconciliation, and clearing postings (5th GL producer)
Documentation
//! Database seeders for the banking module
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! This module provides seed data for initial database setup.
//! Seeders can be run via the seeder binary or CLI.

use anyhow::Result;
use async_trait::async_trait;
use sqlx::PgPool;

mod bank_seeder;
mod bank_account_seeder;
mod bank_clearance_seeder;
mod bank_reconciliation_seeder;
mod bank_statement_import_seeder;
mod bank_transaction_seeder;
mod fx_gain_loss_seeder;
mod reconcile_preset_seeder;

pub use bank_seeder::SeedBankSeeder;
pub use bank_account_seeder::SeedBankAccountSeeder;
pub use bank_clearance_seeder::SeedBankClearanceSeeder;
pub use bank_reconciliation_seeder::SeedBankReconciliationSeeder;
pub use bank_statement_import_seeder::SeedBankStatementImportSeeder;
pub use bank_transaction_seeder::SeedBankTransactionSeeder;
pub use fx_gain_loss_seeder::SeedFxGainLossSeeder;
pub use reconcile_preset_seeder::SeedReconcilePresetSeeder;

// ============================================================================
// SEEDER TRAIT
// ============================================================================

/// Trait for database seeders
#[async_trait]
pub trait Seeder {
    /// Get the name of this seeder
    fn name(&self) -> &'static str;

    /// Get the order in which this seeder should run
    fn order(&self) -> i32;

    /// Check if this seeder should run (e.g., check if data already exists)
    async fn should_run(&self, pool: &PgPool) -> Result<bool>;

    /// Run the seeder
    async fn run(&self, pool: &PgPool) -> Result<()>;

    /// Rollback the seeder (optional)
    async fn rollback(&self, _pool: &PgPool) -> Result<()> {
        Ok(())
    }
}

// ============================================================================
// SEEDER TYPE
// ============================================================================

/// Type of seeder
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SeederType {
    /// Reference data (required for application to function)
    Reference,
    /// Initial production data
    Production,
    /// Development/testing data
    Development,
    /// Test data (for automated tests)
    Test,
}

// ============================================================================
// CUSTOM SEEDERS
// ============================================================================

// <<< CUSTOM SEEDERS START >>>
// Add custom seeders here
// <<< CUSTOM SEEDERS END >>>