8a097dabbe
* add minor todo * BadRequest instead of web3_context * more bad request error codes * use tokio-uring for the tcp listener * clear block instead of panic * clone earlier * more watch channels instead of rwlocks * drop uring for now (its single threaded) and combine get/post/put routes * clean up iter vs into_iter and unnecessary collect * arcswap instead of rwlock for Web3Rpcs.by_name * cargo upgrade * uuid fast-rng and alphabetize * if protected rpcs, only use protected rpcs * listenfd * make connectinfo optional * try_get_with_by_ref instead of try_get_with * anyhow ensure. and try_get_with_as_ref isn't actually needed * fix feature flags * more refs and less clone * automatic retry for eth_getTransactionReceipt and eth_getTransactionByHash thanks for the report Lefteris @ Rotki * ArcSwap for provider * set archive_request to true on transaction retrying * merge durable stats * Revert "ArcSwap for provider" This reverts commit 166d77f204cde9fa7722c0cefecbb27008749d47. * comments * less clones * more refs * fix test * add optional mimalloc feature * remove stale dependency * sort * cargo upgrade * lint constants * add todo * another todo * lint * anyhow::ensure instead of panic * allow rpc_accounting_v2 entries for requests without an rpc key
103 lines
3.2 KiB
Rust
103 lines
3.2 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> {
|
|
// rename tables from plural to singluar
|
|
manager
|
|
.rename_table(
|
|
Table::rename()
|
|
.table(Alias::new("revert_logs"), Alias::new("revert_log"))
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
|
|
manager
|
|
.rename_table(
|
|
Table::rename()
|
|
.table(Alias::new("rpc_keys"), Alias::new("rpc_key"))
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
|
|
// on rpc_key table, rename rpc_key to secret_key
|
|
manager
|
|
.alter_table(
|
|
Table::alter()
|
|
.table(Alias::new("rpc_key"))
|
|
.rename_column(Alias::new("rpc_key"), Alias::new("secret_key"))
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
|
|
// on revert_log table, rename user_key_id to rpc_key_id
|
|
manager
|
|
.alter_table(
|
|
Table::alter()
|
|
.table(Alias::new("revert_log"))
|
|
.rename_column(Alias::new("user_key_id"), Alias::new("rpc_key_id"))
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
|
|
// on rpc_accounting table, rename user_key_id to rpc_key_id
|
|
manager
|
|
.alter_table(
|
|
Table::alter()
|
|
.table(Alias::new("rpc_accounting"))
|
|
.rename_column(Alias::new("user_key_id"), Alias::new("rpc_key_id"))
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
|
|
// on secondary_users table, remove "email" and "address" column
|
|
manager
|
|
.alter_table(
|
|
Table::alter()
|
|
.table(Alias::new("secondary_user"))
|
|
.drop_column(Alias::new("email"))
|
|
.drop_column(Alias::new("address"))
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
|
|
// on user_tier table, rename requests_per_minute to max_requests_per_period
|
|
manager
|
|
.alter_table(
|
|
Table::alter()
|
|
.table(Alias::new("user_tier"))
|
|
.rename_column(
|
|
Alias::new("requests_per_minute"),
|
|
Alias::new("max_requests_per_period"),
|
|
)
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
|
|
manager
|
|
.alter_table(
|
|
Table::alter()
|
|
.table(Alias::new("rpc_key"))
|
|
.drop_column(Alias::new("log_revert_chance"))
|
|
.add_column(
|
|
ColumnDef::new(Alias::new("log_revert_chance"))
|
|
.double()
|
|
.not_null()
|
|
.default(0.0),
|
|
)
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
|
|
Ok(())
|
|
}
|
|
|
|
async fn down(&self, _manager: &SchemaManager) -> Result<(), DbErr> {
|
|
// Replace the sample below with your own migration scripts
|
|
todo!();
|
|
}
|
|
}
|