1pub use sea_orm_migration::prelude::*;
2
3mod m20240226_000001_index_create_channel;
4mod m20240226_000002_index_create_account;
5mod m20240226_000003_index_create_network_registry;
6mod m20240226_000004_index_create_node_info;
7mod m20240226_000005_index_create_chain_info;
8mod m20240226_000006_index_create_network_eligibility;
9mod m20240226_000007_index_initial_seed;
10mod m20240226_000008_node_create_settings;
11mod m20240226_000009_peers_create_peer_store;
12mod m20240301_000010_tickets_create_ticket;
13mod m20240301_000011_tickets_create_ticket_stats;
14mod m20240301_000012_tickets_create_outgoing_ticket_index;
15mod m20240404_000013_tickets_recreate_ticket;
16mod m20240810_000014_index_extend_chain_info_with_pre_checksum_block;
17mod m20240917_000015_add_minimum_incoming_ticket_win_prob_column;
18mod m20240926_000016_peers_create_peer_store_with_new_sea_orm;
19mod m20240930_000017_logs_create_log;
20mod m20241112_000018_logs_add_index;
21mod m20250107_000019_logs_meta_table;
22mod m20250219_000020_logs_add_index;
23mod m20250219_000021_channels_add_index;
24
25#[derive(PartialEq)]
26pub enum BackendType {
27 SQLite,
28 Postgres,
29}
30
31pub struct Migrator;
32
33#[async_trait::async_trait]
36impl MigratorTrait for Migrator {
37 fn migrations() -> Vec<Box<dyn MigrationTrait>> {
38 vec![
39 Box::new(m20240226_000001_index_create_channel::Migration),
40 Box::new(m20240226_000002_index_create_account::Migration),
41 Box::new(m20240226_000003_index_create_network_registry::Migration),
42 Box::new(m20240226_000004_index_create_node_info::Migration),
43 Box::new(m20240226_000005_index_create_chain_info::Migration),
44 Box::new(m20240226_000006_index_create_network_eligibility::Migration),
45 Box::new(m20240226_000007_index_initial_seed::Migration),
46 Box::new(m20240226_000008_node_create_settings::Migration),
47 Box::new(m20240226_000009_peers_create_peer_store::Migration),
48 Box::new(m20240301_000010_tickets_create_ticket::Migration(BackendType::Postgres)),
49 Box::new(m20240301_000011_tickets_create_ticket_stats::Migration(
50 BackendType::Postgres,
51 )),
52 Box::new(m20240301_000012_tickets_create_outgoing_ticket_index::Migration(
53 BackendType::Postgres,
54 )),
55 Box::new(m20240404_000013_tickets_recreate_ticket::Migration(
56 BackendType::Postgres,
57 )),
58 Box::new(m20240810_000014_index_extend_chain_info_with_pre_checksum_block::Migration),
59 Box::new(m20240917_000015_add_minimum_incoming_ticket_win_prob_column::Migration),
60 Box::new(m20240926_000016_peers_create_peer_store_with_new_sea_orm::Migration(
61 BackendType::Postgres,
62 )),
63 Box::new(m20240930_000017_logs_create_log::Migration),
64 Box::new(m20241112_000018_logs_add_index::Migration),
65 Box::new(m20250107_000019_logs_meta_table::Migration),
66 Box::new(m20250219_000020_logs_add_index::Migration),
67 Box::new(m20250219_000021_channels_add_index::Migration),
68 ]
69 }
70}
71
72pub struct MigratorIndex;
78
79#[async_trait::async_trait]
80impl MigratorTrait for MigratorIndex {
81 fn migrations() -> Vec<Box<dyn MigrationTrait>> {
82 vec![
83 Box::new(m20240226_000001_index_create_channel::Migration),
84 Box::new(m20240226_000002_index_create_account::Migration),
85 Box::new(m20240226_000003_index_create_network_registry::Migration),
86 Box::new(m20240226_000004_index_create_node_info::Migration),
87 Box::new(m20240226_000005_index_create_chain_info::Migration),
88 Box::new(m20240226_000006_index_create_network_eligibility::Migration),
89 Box::new(m20240226_000008_node_create_settings::Migration),
90 Box::new(m20240226_000007_index_initial_seed::Migration),
91 Box::new(m20240810_000014_index_extend_chain_info_with_pre_checksum_block::Migration),
92 Box::new(m20240917_000015_add_minimum_incoming_ticket_win_prob_column::Migration),
93 Box::new(m20250219_000021_channels_add_index::Migration),
94 ]
95 }
96}
97
98pub struct MigratorPeers;
99
100#[async_trait::async_trait]
101impl MigratorTrait for MigratorPeers {
102 fn migrations() -> Vec<Box<dyn MigrationTrait>> {
103 vec![
104 Box::new(m20240226_000009_peers_create_peer_store::Migration),
105 Box::new(m20240926_000016_peers_create_peer_store_with_new_sea_orm::Migration(
106 BackendType::SQLite,
107 )),
108 ]
109 }
110}
111
112pub struct MigratorTickets;
113
114#[async_trait::async_trait]
115impl MigratorTrait for MigratorTickets {
116 fn migrations() -> Vec<Box<dyn MigrationTrait>> {
117 vec![
118 Box::new(m20240301_000010_tickets_create_ticket::Migration(BackendType::SQLite)),
119 Box::new(m20240301_000011_tickets_create_ticket_stats::Migration(
120 BackendType::SQLite,
121 )),
122 Box::new(m20240301_000012_tickets_create_outgoing_ticket_index::Migration(
123 BackendType::SQLite,
124 )),
125 Box::new(m20240404_000013_tickets_recreate_ticket::Migration(BackendType::SQLite)),
126 ]
127 }
128}
129
130pub struct MigratorChainLogs;
134
135#[async_trait::async_trait]
136impl MigratorTrait for MigratorChainLogs {
137 fn migrations() -> Vec<Box<dyn MigrationTrait>> {
138 vec![
139 Box::new(m20240930_000017_logs_create_log::Migration),
140 Box::new(m20241112_000018_logs_add_index::Migration),
141 Box::new(m20250107_000019_logs_meta_table::Migration),
142 Box::new(m20250219_000020_logs_add_index::Migration),
143 ]
144 }
145}