backbone_integrations/seeders/mod.rs
1//! Database seeders for the integrations module
2//!
3//! Generated by metaphor-schema. Do not edit manually.
4//!
5//! This module provides seed data for initial database setup.
6//! Seeders can be run via the seeder binary or CLI.
7
8use anyhow::Result;
9use async_trait::async_trait;
10use sqlx::PgPool;
11
12mod integration_connector_seeder;
13mod integration_event_seeder;
14
15pub use integration_connector_seeder::SeedIntegrationConnectorSeeder;
16pub use integration_event_seeder::SeedIntegrationEventSeeder;
17
18// ============================================================================
19// SEEDER TRAIT
20// ============================================================================
21
22/// Trait for database seeders
23#[async_trait]
24pub trait Seeder {
25 /// Get the name of this seeder
26 fn name(&self) -> &'static str;
27
28 /// Get the order in which this seeder should run
29 fn order(&self) -> i32;
30
31 /// Check if this seeder should run (e.g., check if data already exists)
32 async fn should_run(&self, pool: &PgPool) -> Result<bool>;
33
34 /// Run the seeder
35 async fn run(&self, pool: &PgPool) -> Result<()>;
36
37 /// Rollback the seeder (optional)
38 async fn rollback(&self, _pool: &PgPool) -> Result<()> {
39 Ok(())
40 }
41}
42
43// ============================================================================
44// SEEDER TYPE
45// ============================================================================
46
47/// Type of seeder
48#[derive(Debug, Clone, Copy, PartialEq, Eq)]
49pub enum SeederType {
50 /// Reference data (required for application to function)
51 Reference,
52 /// Initial production data
53 Production,
54 /// Development/testing data
55 Development,
56 /// Test data (for automated tests)
57 Test,
58}
59
60// ============================================================================
61// CUSTOM SEEDERS
62// ============================================================================
63
64// <<< CUSTOM SEEDERS START >>>
65// Add custom seeders here
66// <<< CUSTOM SEEDERS END >>>