Skip to content

Commit

Permalink
Fix SQL Upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
mkysel committed Feb 10, 2025
1 parent e5ef9f9 commit efe38ea
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions dev/run
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ export XMTPD_REPLICATION_ENABLE=true
export XMTPD_SYNC_ENABLE=true
export XMTPD_INDEXER_ENABLE=true

export XMTPD_CONTRACTS_NODES_ADDRESS=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
export XMTPD_CONTRACTS_IDENTITY_UPDATES_ADDRESS=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
export XMTPD_CONTRACTS_MESSAGES_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3


go run -ldflags="-X main.Version=$(git describe HEAD --tags --long)" cmd/replication/main.go "$@"
3 changes: 1 addition & 2 deletions pkg/migrations/00003_add-latest-block.up.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
CREATE TABLE latest_block(
contract_address TEXT NOT NULL PRIMARY KEY,
block_number BIGINT NOT NULL,
block_hash BYTEA NOT NULL
block_number BIGINT NOT NULL
);

2 changes: 2 additions & 0 deletions pkg/migrations/00004_add_blockchain_columns.down.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ DROP INDEX IF EXISTS idx_blockchain_messages_canonical;
-- Then drop the table
DROP TABLE IF EXISTS blockchain_messages;

-- Drop newly added column
ALTER TABLE latest_block DROP COLUMN IF EXISTS block_hash;
1 change: 1 addition & 0 deletions pkg/migrations/00004_add_blockchain_columns.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ CREATE TABLE blockchain_messages(

CREATE INDEX idx_blockchain_messages_block_canonical ON blockchain_messages(block_number, is_canonical);

ALTER TABLE latest_block ADD COLUMN block_hash BYTEA;

0 comments on commit efe38ea

Please sign in to comment.