Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

fix: remove foreign key constraint #77

Merged
merged 2 commits into from
Jan 19, 2024
Merged
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
32 changes: 1 addition & 31 deletions src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ impl Database {
/// Save all the transactions in txs, it is up to the caller to
/// call sqlx_tx.commit().await?; for the changes to take place in
/// database.
#[instrument(skip(txs, block_id, sqlx_tx, checksums_map, block_height, network))]
#[instrument(skip(txs, block_id, sqlx_tx, checksums_map, network))]
async fn save_transactions<'a>(
txs: &Vec<Vec<u8>>,
block_id: &[u8],
Expand Down Expand Up @@ -1023,16 +1023,6 @@ impl Database {
.execute(&*self.pool)
.await?;

query(
format!(
"ALTER TABLE {0}.tx_transfer ADD CONSTRAINT fk_tx_id FOREIGN KEY (tx_id) REFERENCES {0}.transactions (hash);",
self.network
)
.as_str(),
)
.execute(&*self.pool)
.await?;

query(
format!(
"CREATE INDEX x_source_transfer ON {}.tx_transfer (source);",
Expand Down Expand Up @@ -1063,16 +1053,6 @@ impl Database {
.execute(&*self.pool)
.await?;

query(
format!(
"ALTER TABLE {0}.tx_bond ADD CONSTRAINT fk_tx_id FOREIGN KEY (tx_id) REFERENCES {0}.transactions (hash);",
self.network
)
.as_str(),
)
.execute(&*self.pool)
.await?;

query(
format!(
"ALTER TABLE {}.tx_bridge_pool ADD CONSTRAINT pk_tx_id_bridge PRIMARY KEY (tx_id);",
Expand All @@ -1083,16 +1063,6 @@ impl Database {
.execute(&*self.pool)
.await?;

query(
format!(
"ALTER TABLE {0}.tx_bridge_pool ADD CONSTRAINT fk_tx_id FOREIGN KEY (tx_id) REFERENCES {0}.transactions (hash);",
self.network
)
.as_str(),
)
.execute(&*self.pool)
.await?;

query(
format!(
"CREATE INDEX x_validator_bond ON {}.tx_bond (validator);",
Expand Down
Loading