Skip to content

Commit

Permalink
Merge pull request #696 from blockscout/kf/chore/bump-sea-orm-0.12
Browse files Browse the repository at this point in the history
Bump sea-orm in blockscout-db to 0.12
  • Loading branch information
k1rill-fedoseev authored Dec 11, 2023
2 parents 03e837c + ccf7bf5 commit bb2eb15
Show file tree
Hide file tree
Showing 39 changed files with 186 additions and 75 deletions.
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ name = "entity"
path = "src/lib.rs"

[dependencies]
sea-orm = { version = "0.10", features = [ "sqlx-postgres", "runtime-tokio-rustls", "macros", "postgres-array" ] }
sea-orm = { version = "0.12", features = [ "sqlx-postgres", "runtime-tokio-rustls", "macros", "postgres-array" ] }
8 changes: 6 additions & 2 deletions libs/blockscout-db/entity/src/address_coin_balances.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "address_coin_balances")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Binary(BlobSize::Blob(None))"
)]
pub address_hash: Vec<u8>,
#[sea_orm(primary_key, auto_increment = false)]
pub block_number: i64,
Expand Down
8 changes: 6 additions & 2 deletions libs/blockscout-db/entity/src/address_coin_balances_daily.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "address_coin_balances_daily")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Binary(BlobSize::Blob(None))"
)]
pub address_hash: Vec<u8>,
#[sea_orm(primary_key, auto_increment = false)]
pub day: Date,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

Expand All @@ -7,8 +7,10 @@ use sea_orm::entity::prelude::*;
pub struct Model {
#[sea_orm(primary_key)]
pub id: i64,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub address_hash: Vec<u8>,
pub block_number: i64,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub token_contract_address_hash: Vec<u8>,
pub value: Option<Decimal>,
pub value_fetched_at: Option<DateTime>,
Expand Down
4 changes: 3 additions & 1 deletion libs/blockscout-db/entity/src/address_names.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "address_names")]
pub struct Model {
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub address_hash: Vec<u8>,
pub name: String,
pub primary: bool,
pub inserted_at: DateTime,
pub updated_at: DateTime,
#[sea_orm(column_type = "JsonBinary", nullable)]
pub metadata: Option<Json>,
#[sea_orm(primary_key)]
pub id: i32,
Expand Down
4 changes: 3 additions & 1 deletion libs/blockscout-db/entity/src/address_token_balances.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

Expand All @@ -7,8 +7,10 @@ use sea_orm::entity::prelude::*;
pub struct Model {
#[sea_orm(primary_key)]
pub id: i64,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub address_hash: Vec<u8>,
pub block_number: i64,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub token_contract_address_hash: Vec<u8>,
pub value: Option<Decimal>,
pub value_fetched_at: Option<DateTime>,
Expand Down
9 changes: 7 additions & 2 deletions libs/blockscout-db/entity/src/addresses.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

Expand All @@ -8,8 +8,13 @@ pub struct Model {
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub fetched_coin_balance: Option<Decimal>,
pub fetched_coin_balance_block_number: Option<i64>,
#[sea_orm(primary_key, auto_increment = false)]
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Binary(BlobSize::Blob(None))"
)]
pub hash: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
pub contract_code: Option<Vec<u8>>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/src/administrators.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

Expand Down
14 changes: 11 additions & 3 deletions libs/blockscout-db/entity/src/block_rewards.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "block_rewards")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Binary(BlobSize::Blob(None))"
)]
pub address_hash: Vec<u8>,
#[sea_orm(primary_key, auto_increment = false)]
pub address_type: String,
#[sea_orm(primary_key, auto_increment = false)]
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Binary(BlobSize::Blob(None))"
)]
pub block_hash: Vec<u8>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub reward: Option<Decimal>,
Expand Down
14 changes: 11 additions & 3 deletions libs/blockscout-db/entity/src/block_second_degree_relations.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "block_second_degree_relations")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Binary(BlobSize::Blob(None))"
)]
pub nephew_hash: Vec<u8>,
#[sea_orm(primary_key, auto_increment = false)]
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Binary(BlobSize::Blob(None))"
)]
pub uncle_hash: Vec<u8>,
pub uncle_fetched_at: Option<DateTime>,
pub index: Option<i32>,
Expand Down
16 changes: 13 additions & 3 deletions libs/blockscout-db/entity/src/blocks.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

Expand All @@ -12,11 +12,18 @@ pub struct Model {
pub gas_limit: Decimal,
#[sea_orm(column_type = "Decimal(Some((100, 0)))")]
pub gas_used: Decimal,
#[sea_orm(primary_key, auto_increment = false)]
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Binary(BlobSize::Blob(None))"
)]
pub hash: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub miner_hash: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub nonce: Vec<u8>,
pub number: i64,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub parent_hash: Vec<u8>,
pub size: Option<i32>,
pub timestamp: DateTime,
Expand Down Expand Up @@ -108,7 +115,10 @@ impl Related<super::transaction_forks::Entity> for Entity {

impl Related<super::transactions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Transactions.def()
super::transaction_forks::Relation::Transactions.def()
}
fn via() -> Option<RelationDef> {
Some(super::transaction_forks::Relation::Blocks.def().rev())
}
}

Expand Down
3 changes: 2 additions & 1 deletion libs/blockscout-db/entity/src/contract_methods.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

Expand All @@ -8,6 +8,7 @@ pub struct Model {
#[sea_orm(primary_key)]
pub id: i64,
pub identifier: i32,
#[sea_orm(column_type = "JsonBinary")]
pub abi: Json,
pub r#type: String,
pub inserted_at: DateTime,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

Expand All @@ -8,6 +8,7 @@ pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub uid: String,
pub status: i16,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub address_hash: Vec<u8>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
Expand Down
3 changes: 2 additions & 1 deletion libs/blockscout-db/entity/src/decompiled_smart_contracts.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

Expand All @@ -10,6 +10,7 @@ pub struct Model {
pub decompiler_version: String,
#[sea_orm(column_type = "Text")]
pub decompiled_source_code: String,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub address_hash: Vec<u8>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
Expand Down
4 changes: 2 additions & 2 deletions libs/blockscout-db/entity/src/emission_rewards.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

Expand All @@ -8,7 +8,7 @@ pub struct Model {
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Custom(\"int8range\".to_owned())"
column_type = "custom(\"int8range\")"
)]
pub block_range: String,
pub reward: Option<Decimal>,
Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/src/event_notifications.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

Expand Down
16 changes: 14 additions & 2 deletions libs/blockscout-db/entity/src/internal_transactions.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "internal_transactions")]
pub struct Model {
pub call_type: Option<String>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
pub created_contract_code: Option<Vec<u8>>,
pub error: Option<String>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub gas: Option<Decimal>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub gas_used: Option<Decimal>,
pub index: i32,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
pub init: Option<Vec<u8>>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
pub input: Option<Vec<u8>>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
pub output: Option<Vec<u8>>,
pub trace_address: Vec<i32>,
pub r#type: String,
#[sea_orm(column_type = "Decimal(Some((100, 0)))")]
pub value: Decimal,
pub inserted_at: DateTime,
pub updated_at: DateTime,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
pub created_contract_address_hash: Option<Vec<u8>>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
pub from_address_hash: Option<Vec<u8>>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
pub to_address_hash: Option<Vec<u8>>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub transaction_hash: Vec<u8>,
pub block_number: Option<i32>,
pub transaction_index: Option<i32>,
#[sea_orm(primary_key, auto_increment = false)]
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Binary(BlobSize::Blob(None))"
)]
pub block_hash: Vec<u8>,
#[sea_orm(primary_key, auto_increment = false)]
pub block_index: i32,
Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/src/last_fetched_counters.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

Expand Down
3 changes: 1 addition & 2 deletions libs/blockscout-db/entity/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
pub mod prelude;

Expand All @@ -23,7 +23,6 @@ pub mod logs;
pub mod market_history;
pub mod pending_block_operations;
pub mod schema_migrations;
pub mod sea_orm_active_enums;
pub mod smart_contracts;
pub mod smart_contracts_additional_sources;
pub mod token_instances;
Expand Down
16 changes: 13 additions & 3 deletions libs/blockscout-db/entity/src/logs.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "logs")]
pub struct Model {
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub data: Vec<u8>,
#[sea_orm(primary_key, auto_increment = false)]
pub index: i32,
Expand All @@ -15,10 +16,19 @@ pub struct Model {
pub fourth_topic: Option<String>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)]
pub address_hash: Option<Vec<u8>>,
#[sea_orm(primary_key, auto_increment = false)]
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Binary(BlobSize::Blob(None))"
)]
pub transaction_hash: Vec<u8>,
#[sea_orm(primary_key, auto_increment = false)]
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "Binary(BlobSize::Blob(None))"
)]
pub block_hash: Vec<u8>,
pub block_number: Option<i32>,
}
Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/src/market_history.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.4
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
use sea_orm::entity::prelude::*;

Expand Down
Loading

0 comments on commit bb2eb15

Please sign in to comment.