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
79 lines
2.6 KiB
Rust
79 lines
2.6 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> {
|
|
manager
|
|
.create_table(
|
|
Table::create()
|
|
.table(AdminTrail::Table)
|
|
.if_not_exists()
|
|
.col(
|
|
ColumnDef::new(AdminTrail::Id)
|
|
.integer()
|
|
.not_null()
|
|
.auto_increment()
|
|
.primary_key(),
|
|
)
|
|
.col(
|
|
ColumnDef::new(AdminTrail::Caller).big_unsigned().not_null(), // TODO: Add Foreign Key
|
|
)
|
|
.foreign_key(
|
|
sea_query::ForeignKey::create()
|
|
.from(AdminTrail::Table, AdminTrail::Caller)
|
|
.to(User::Table, User::Id),
|
|
)
|
|
.col(
|
|
ColumnDef::new(AdminTrail::ImitatingUser).big_unsigned(), // Can be null bcs maybe we're just logging in / using endpoints that don't imitate a user
|
|
// TODO: Add Foreign Key
|
|
)
|
|
.foreign_key(
|
|
sea_query::ForeignKey::create()
|
|
.from(AdminTrail::Table, AdminTrail::ImitatingUser)
|
|
.to(User::Table, User::Id),
|
|
)
|
|
.col(ColumnDef::new(AdminTrail::Endpoint).string().not_null())
|
|
.col(ColumnDef::new(AdminTrail::Payload).string().not_null())
|
|
.col(
|
|
ColumnDef::new(AdminTrail::Timestamp)
|
|
.timestamp()
|
|
.not_null()
|
|
.extra("DEFAULT CURRENT_TIMESTAMP".to_string()),
|
|
)
|
|
.to_owned(),
|
|
)
|
|
.await
|
|
}
|
|
|
|
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
manager
|
|
.drop_table(Table::drop().table(AdminTrail::Table).to_owned())
|
|
.await
|
|
}
|
|
}
|
|
|
|
/// Learn more at https://docs.rs/sea-query#iden
|
|
#[derive(Iden)]
|
|
enum AdminTrail {
|
|
Table,
|
|
Id,
|
|
Caller,
|
|
ImitatingUser,
|
|
Endpoint,
|
|
Payload,
|
|
Timestamp,
|
|
}
|
|
|
|
/// Learn more at https://docs.rs/sea-query#iden
|
|
#[derive(Iden)]
|
|
enum User {
|
|
Table,
|
|
Id,
|
|
// Address,
|
|
// Description,
|
|
// Email,
|
|
}
|