Skip to content

Commit

Permalink
Fix migration of Block collection: payload field didn't exist before (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gostkin authored Mar 24, 2023
1 parent 75bf44f commit 6d13f55
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion indexer/entity/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct Model {
pub height: i32,
pub epoch: i32,
pub slot: i32,
pub payload: Vec<u8>,
pub payload: Option<Vec<u8>>,
}

#[derive(Copy, Clone, Debug, DeriveRelation, EnumIter)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl MigrationTrait for Migration {
.alter_table(
Table::alter()
.table(Entity)
.add_column(ColumnDef::new(Column::Payload).binary().not_null())
.add_column(ColumnDef::new(Column::Payload).binary())
.to_owned(),
)
.await
Expand Down
2 changes: 1 addition & 1 deletion indexer/tasks/src/byron/byron_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async fn handle_block(
height: Set(block.1.number() as i32),
epoch: Set(block.1.header().as_byron().unwrap().consensus_data.0.epoch as i32),
slot: Set(block.1.slot() as i32),
payload: Set(block_payload),
payload: Set(Some(block_payload)),
..Default::default()
};

Expand Down
2 changes: 1 addition & 1 deletion indexer/tasks/src/genesis/genesis_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async fn handle_block(
height: Set(0),
epoch: Set(0),
slot: Set(0),
payload: Set(block_payload),
payload: Set(Some(block_payload)),
..Default::default()
};

Expand Down
2 changes: 1 addition & 1 deletion indexer/tasks/src/multiera/multiera_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async fn handle_block(
height: Set(block.1.number() as i32),
epoch: Set(block.2.epoch.unwrap() as i32),
slot: Set(block.1.slot() as i32),
payload: Set(block_payload),
payload: Set(Some(block_payload)),
..Default::default()
};
block.insert(db_tx).await
Expand Down

0 comments on commit 6d13f55

Please sign in to comment.