Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix migration of Block collection: payload field didn't exist before #148

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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