migration/
m20240226_000006_index_create_network_eligibility.rs1use sea_orm_migration::prelude::*;
2
3#[derive(DeriveMigrationName)]
4pub struct Migration;
5
6#[async_trait::async_trait]
7impl MigrationTrait for Migration {
8 async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
9 manager
10 .create_table(
11 Table::create()
12 .table(NetworkEligibility::Table)
13 .if_not_exists()
14 .col(
15 ColumnDef::new(NetworkEligibility::Id)
16 .integer()
17 .not_null()
18 .auto_increment()
19 .primary_key(),
20 )
21 .col(
22 ColumnDef::new(NetworkEligibility::SafeAddress)
23 .string()
24 .not_null()
25 .unique_key(),
26 )
27 .to_owned(),
28 )
29 .await
30 }
31
32 async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
33 manager
34 .drop_table(Table::drop().table(NetworkEligibility::Table).to_owned())
35 .await
36 }
37}
38
39#[derive(DeriveIden)]
40enum NetworkEligibility {
41 Table,
42 Id,
43 SafeAddress,
44}