a083bc652d
* add more columns to handle uncled transactions * handle payment uncles * put relations back * include all the new columns * lower log levels * improve block caching if we have a block with a number, its canonical. uncles don't get returned * improve disconnect logic * lint * clear first changed for new_top_config_receiver * better logs around config changing * i guess we do want one apply top_config at the start * check correct variable for data limits
72 lines
2.3 KiB
Rust
72 lines
2.3 KiB
Rust
use sea_orm_migration::prelude::*;
|
|
|
|
#[derive(DeriveMigrationName)]
|
|
pub struct Migration;
|
|
|
|
#[async_trait::async_trait]
|
|
impl MigrationTrait for Migration {
|
|
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
// TODO: also alter the index to include the BlockHash? or
|
|
manager
|
|
.alter_table(
|
|
Table::alter()
|
|
.table(IncreaseOnChainBalanceReceipt::Table)
|
|
.add_column(
|
|
ColumnDef::new(IncreaseOnChainBalanceReceipt::BlockHash)
|
|
.string()
|
|
.not_null(),
|
|
)
|
|
.add_column(
|
|
ColumnDef::new(IncreaseOnChainBalanceReceipt::LogIndex)
|
|
.big_integer()
|
|
.unsigned()
|
|
.not_null(),
|
|
)
|
|
.add_column(
|
|
ColumnDef::new(IncreaseOnChainBalanceReceipt::TokenAddress)
|
|
.string()
|
|
.not_null(),
|
|
)
|
|
.drop_foreign_key(Alias::new("fk-deposit_to_user_id"))
|
|
.add_foreign_key(
|
|
TableForeignKey::new()
|
|
.name("fk-deposit_to_user_id-v2")
|
|
.from_col(IncreaseOnChainBalanceReceipt::DepositToUserId)
|
|
.to_tbl(User::Table)
|
|
.to_col(User::Id),
|
|
)
|
|
.to_owned(),
|
|
)
|
|
.await
|
|
}
|
|
|
|
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
manager
|
|
.alter_table(
|
|
Table::alter()
|
|
.table(IncreaseOnChainBalanceReceipt::Table)
|
|
.drop_column(IncreaseOnChainBalanceReceipt::BlockHash)
|
|
.drop_column(IncreaseOnChainBalanceReceipt::LogIndex)
|
|
.drop_column(IncreaseOnChainBalanceReceipt::TokenAddress)
|
|
.to_owned(),
|
|
)
|
|
.await
|
|
}
|
|
}
|
|
|
|
/// Learn more at https://docs.rs/sea-query#iden
|
|
#[derive(Iden)]
|
|
enum IncreaseOnChainBalanceReceipt {
|
|
Table,
|
|
BlockHash,
|
|
LogIndex,
|
|
TokenAddress,
|
|
DepositToUserId,
|
|
}
|
|
|
|
#[derive(Iden)]
|
|
enum User {
|
|
Table,
|
|
Id,
|
|
}
|