lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README | LICENSE

migrations.rs (5699B)


      1 use radroots_sql_core::SqlExecutor;
      2 use radroots_sql_core::error::SqlError;
      3 use radroots_sql_core::migrations::{Migration, migrations_run_all_down, migrations_run_all_up};
      4 
      5 pub static MIGRATIONS: &[Migration] = &[
      6     Migration {
      7         name: "0000_init",
      8         up_sql: include_str!("../migrations/0000_init.up.sql"),
      9         down_sql: include_str!("../migrations/0000_init.down.sql"),
     10     },
     11     Migration {
     12         name: "0001_log_error",
     13         up_sql: include_str!("../migrations/0001_log_error.up.sql"),
     14         down_sql: include_str!("../migrations/0001_log_error.down.sql"),
     15     },
     16     Migration {
     17         name: "0002_farm",
     18         up_sql: include_str!("../migrations/0002_farm.up.sql"),
     19         down_sql: include_str!("../migrations/0002_farm.down.sql"),
     20     },
     21     Migration {
     22         name: "0003_gcs_location",
     23         up_sql: include_str!("../migrations/0003_gcs_location.up.sql"),
     24         down_sql: include_str!("../migrations/0003_gcs_location.down.sql"),
     25     },
     26     Migration {
     27         name: "0004_trade_product",
     28         up_sql: include_str!("../migrations/0004_trade_product.up.sql"),
     29         down_sql: include_str!("../migrations/0004_trade_product.down.sql"),
     30     },
     31     Migration {
     32         name: "0005_nostr_profile",
     33         up_sql: include_str!("../migrations/0005_nostr_profile.up.sql"),
     34         down_sql: include_str!("../migrations/0005_nostr_profile.down.sql"),
     35     },
     36     Migration {
     37         name: "0006_nostr_relay",
     38         up_sql: include_str!("../migrations/0006_nostr_relay.up.sql"),
     39         down_sql: include_str!("../migrations/0006_nostr_relay.down.sql"),
     40     },
     41     Migration {
     42         name: "0007_media_image",
     43         up_sql: include_str!("../migrations/0007_media_image.up.sql"),
     44         down_sql: include_str!("../migrations/0007_media_image.down.sql"),
     45     },
     46     Migration {
     47         name: "0008_farm_gcs_location",
     48         up_sql: include_str!("../migrations/0008_farm_gcs_location.up.sql"),
     49         down_sql: include_str!("../migrations/0008_farm_gcs_location.down.sql"),
     50     },
     51     Migration {
     52         name: "0009_nostr_profile_relay",
     53         up_sql: include_str!("../migrations/0009_nostr_profile_relay.up.sql"),
     54         down_sql: include_str!("../migrations/0009_nostr_profile_relay.down.sql"),
     55     },
     56     Migration {
     57         name: "0010_trade_product_location",
     58         up_sql: include_str!("../migrations/0010_trade_product_location.up.sql"),
     59         down_sql: include_str!("../migrations/0010_trade_product_location.down.sql"),
     60     },
     61     Migration {
     62         name: "0011_trade_product_media",
     63         up_sql: include_str!("../migrations/0011_trade_product_media.up.sql"),
     64         down_sql: include_str!("../migrations/0011_trade_product_media.down.sql"),
     65     },
     66     Migration {
     67         name: "0012_plot",
     68         up_sql: include_str!("../migrations/0012_plot.up.sql"),
     69         down_sql: include_str!("../migrations/0012_plot.down.sql"),
     70     },
     71     Migration {
     72         name: "0013_plot_gcs_location",
     73         up_sql: include_str!("../migrations/0013_plot_gcs_location.up.sql"),
     74         down_sql: include_str!("../migrations/0013_plot_gcs_location.down.sql"),
     75     },
     76     Migration {
     77         name: "0014_farm_tag",
     78         up_sql: include_str!("../migrations/0014_farm_tag.up.sql"),
     79         down_sql: include_str!("../migrations/0014_farm_tag.down.sql"),
     80     },
     81     Migration {
     82         name: "0015_plot_tag",
     83         up_sql: include_str!("../migrations/0015_plot_tag.up.sql"),
     84         down_sql: include_str!("../migrations/0015_plot_tag.down.sql"),
     85     },
     86     Migration {
     87         name: "0016_farm_member",
     88         up_sql: include_str!("../migrations/0016_farm_member.up.sql"),
     89         down_sql: include_str!("../migrations/0016_farm_member.down.sql"),
     90     },
     91     Migration {
     92         name: "0017_farm_member_claim",
     93         up_sql: include_str!("../migrations/0017_farm_member_claim.up.sql"),
     94         down_sql: include_str!("../migrations/0017_farm_member_claim.down.sql"),
     95     },
     96     Migration {
     97         name: "0018_nostr_event_head",
     98         up_sql: include_str!("../migrations/0018_nostr_event_head.up.sql"),
     99         down_sql: include_str!("../migrations/0018_nostr_event_head.down.sql"),
    100     },
    101     Migration {
    102         name: "0019_repair_missing_indexes",
    103         up_sql: include_str!("../migrations/0019_repair_missing_indexes.up.sql"),
    104         down_sql: include_str!("../migrations/0019_repair_missing_indexes.down.sql"),
    105     },
    106     Migration {
    107         name: "0020_trade_product_listing_addr",
    108         up_sql: include_str!("../migrations/0020_trade_product_listing_addr.up.sql"),
    109         down_sql: include_str!("../migrations/0020_trade_product_listing_addr.down.sql"),
    110     },
    111     Migration {
    112         name: "0021_trade_product_primary_bin_id",
    113         up_sql: include_str!("../migrations/0021_trade_product_primary_bin_id.up.sql"),
    114         down_sql: include_str!("../migrations/0021_trade_product_primary_bin_id.down.sql"),
    115     },
    116     Migration {
    117         name: "0022_trade_product_exact_economics",
    118         up_sql: include_str!("../migrations/0022_trade_product_exact_economics.up.sql"),
    119         down_sql: include_str!("../migrations/0022_trade_product_exact_economics.down.sql"),
    120     },
    121     Migration {
    122         name: "0023_trade_product_verified_primary_bin",
    123         up_sql: include_str!("../migrations/0023_trade_product_verified_primary_bin.up.sql"),
    124         down_sql: include_str!("../migrations/0023_trade_product_verified_primary_bin.down.sql"),
    125     },
    126 ];
    127 
    128 pub fn run_all_up<E>(executor: &E) -> Result<(), SqlError>
    129 where
    130     E: SqlExecutor,
    131 {
    132     migrations_run_all_up(executor, MIGRATIONS)
    133 }
    134 
    135 pub fn run_all_down<E>(executor: &E) -> Result<(), SqlError>
    136 where
    137     E: SqlExecutor,
    138 {
    139     migrations_run_all_down(executor, MIGRATIONS)
    140 }