backbone_activity/seeders/mod.rs
1//! Database seeders for the activity 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 activity_seeder;
13
14pub use activity_seeder::SeedActivitySeeder;
15
16// ============================================================================
17// SEEDER TRAIT
18// ============================================================================
19
20/// Trait for database seeders
21#[async_trait]
22pub trait Seeder {
23 /// Get the name of this seeder
24 fn name(&self) -> &'static str;
25
26 /// Get the order in which this seeder should run
27 fn order(&self) -> i32;
28
29 /// Check if this seeder should run (e.g., check if data already exists)
30 async fn should_run(&self, pool: &PgPool) -> Result<bool>;
31
32 /// Run the seeder
33 async fn run(&self, pool: &PgPool) -> Result<()>;
34
35 /// Rollback the seeder (optional)
36 async fn rollback(&self, _pool: &PgPool) -> Result<()> {
37 Ok(())
38 }
39}
40
41// ============================================================================
42// SEEDER TYPE
43// ============================================================================
44
45/// Type of seeder
46#[derive(Debug, Clone, Copy, PartialEq, Eq)]
47pub enum SeederType {
48 /// Reference data (required for application to function)
49 Reference,
50 /// Initial production data
51 Production,
52 /// Development/testing data
53 Development,
54 /// Test data (for automated tests)
55 Test,
56}
57
58// ============================================================================
59// CUSTOM SEEDERS
60// ============================================================================
61
62// Add custom seeders here
63