backbone-activity 0.5.0

Sales activity / touchpoints + rep tasks — the substrate lead/deal sit on
Documentation
//! Database seeders for the activity 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 activity_seeder;

pub use activity_seeder::SeedActivitySeeder;

// ============================================================================
// 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
// ============================================================================

// Add custom seeders here