-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update cardano source (less settings required) and add shelley genesi…
…s processing task
- Loading branch information
1 parent
2fa8e10
commit 165e11b
Showing
23 changed files
with
676 additions
and
428 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use sea_orm::entity::prelude::*; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)] | ||
#[sea_orm(table_name = "Era")] | ||
pub struct Model { | ||
#[sea_orm(primary_key)] | ||
pub era: i32, | ||
pub block_id: i32, | ||
pub block_height: i32, | ||
pub first_slot: i64, | ||
pub start_epoch: i64, | ||
pub epoch_length_seconds: i64, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, DeriveRelation, EnumIter)] | ||
pub enum Relation { | ||
#[sea_orm( | ||
belongs_to = "super::block::Entity", | ||
from = "Column::BlockId", | ||
to = "super::block::Column::Id" | ||
)] | ||
Block, | ||
} | ||
|
||
impl Related<super::block::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Block.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
indexer/migration/src/m20240920_000022_create_genesis_tracking_table.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use sea_schema::migration::prelude::*; | ||
|
||
use entity::genesis::*; | ||
use entity::prelude::{Block, BlockColumn}; | ||
|
||
pub struct Migration; | ||
|
||
impl MigrationName for Migration { | ||
fn name(&self) -> &str { | ||
"m20240920_000022_create_genesis_tracking_table" | ||
} | ||
} | ||
|
||
#[async_trait::async_trait] | ||
impl MigrationTrait for Migration { | ||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { | ||
manager | ||
.create_table( | ||
Table::create() | ||
.table(Entity) | ||
.if_not_exists() | ||
.col( | ||
ColumnDef::new(Column::Era) | ||
.integer() | ||
.not_null() | ||
.primary_key(), | ||
) | ||
.col(ColumnDef::new(Column::BlockId).integer().not_null()) | ||
.col(ColumnDef::new(Column::BlockHeight).integer().not_null()) | ||
.col(ColumnDef::new(Column::FirstSlot).big_integer().not_null()) | ||
.col(ColumnDef::new(Column::StartEpoch).big_integer().not_null()) | ||
.col( | ||
ColumnDef::new(Column::EpochLengthSeconds) | ||
.big_integer() | ||
.not_null(), | ||
) | ||
.foreign_key( | ||
ForeignKey::create() | ||
.name("fk-transaction-block_id") | ||
.from(Entity, Column::BlockId) | ||
.to(Block, BlockColumn::Id) | ||
.on_delete(ForeignKeyAction::Cascade), | ||
) | ||
.to_owned(), | ||
) | ||
.await?; | ||
|
||
Ok(()) | ||
} | ||
|
||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { | ||
manager | ||
.drop_table(Table::drop().table(Entity).to_owned()) | ||
.await | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.