Skip to content

Commit 62c274f

Browse files
committed
fix: replace allocation id with collection id in migrations
Signed-off-by: Tomás Migone <[email protected]>
1 parent 65fd709 commit 62c274f

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

migrations/20250131122241_tap_horizon_receipts.up.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS tap_horizon_receipts (
55

66
-- Values below are the individual fields of the EIP-712 receipt
77
signature BYTEA NOT NULL,
8-
allocation_id CHAR(40) NOT NULL,
8+
collection_id CHAR(64) NOT NULL,
99
payer CHAR(40) NOT NULL,
1010
data_service CHAR(40) NOT NULL,
1111
service_provider CHAR(40) NOT NULL,
@@ -14,14 +14,14 @@ CREATE TABLE IF NOT EXISTS tap_horizon_receipts (
1414
value NUMERIC(39) NOT NULL
1515
);
1616

17-
CREATE INDEX IF NOT EXISTS tap_horizon_receipts_allocation_id_idx ON tap_horizon_receipts (allocation_id);
17+
CREATE INDEX IF NOT EXISTS tap_horizon_receipts_collection_id_idx ON tap_horizon_receipts (collection_id);
1818
CREATE INDEX IF NOT EXISTS tap_horizon_receipts_timestamp_ns_idx ON tap_horizon_receipts (timestamp_ns);
1919

2020
CREATE FUNCTION tap_horizon_receipt_notify()
2121
RETURNS trigger AS
2222
$$
2323
BEGIN
24-
PERFORM pg_notify('tap_horizon_receipt_notification', format('{"id": %s, "allocation_id": "%s", "signer_address": "%s", "timestamp_ns": %s, "value": %s}', NEW.id, NEW.allocation_id, NEW.signer_address, NEW.timestamp_ns, NEW.value));
24+
PERFORM pg_notify('tap_horizon_receipt_notification', format('{"id": %s, "collection_id": "%s", "signer_address": "%s", "timestamp_ns": %s, "value": %s}', NEW.id, NEW.collection_id, NEW.signer_address, NEW.timestamp_ns, NEW.value));
2525
RETURN NEW;
2626
END;
2727
$$ LANGUAGE 'plpgsql';
@@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS tap_horizon_receipts_invalid (
3939

4040
-- Values below are the individual fields of the EIP-712 receipt
4141
signature BYTEA NOT NULL,
42-
allocation_id CHAR(40) NOT NULL,
42+
collection_id CHAR(64) NOT NULL,
4343
payer CHAR(40) NOT NULL,
4444
data_service CHAR(40) NOT NULL,
4545
service_provider CHAR(40) NOT NULL,

migrations/20250210152412_tap_horizon_ravs.up.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
CREATE TABLE IF NOT EXISTS tap_horizon_ravs (
33
-- Values below are the individual fields of the EIP-712 RAV
44
signature BYTEA NOT NULL,
5-
allocation_id CHAR(40) NOT NULL,
5+
collection_id CHAR(64) NOT NULL,
66
payer CHAR(40) NOT NULL,
77
data_service CHAR(40) NOT NULL,
88
service_provider CHAR(40) NOT NULL,
@@ -12,9 +12,10 @@ CREATE TABLE IF NOT EXISTS tap_horizon_ravs (
1212

1313
last BOOLEAN DEFAULT FALSE NOT NULL,
1414
final BOOLEAN DEFAULT FALSE NOT NULL,
15-
PRIMARY KEY (payer, data_service, service_provider, allocation_id),
15+
PRIMARY KEY (payer, data_service, service_provider, collection_id),
1616

1717
-- To make indexer-agent's sequelize happy
18+
redeemed_at TIMESTAMP WITH TIME ZONE,
1819
created_at TIMESTAMP WITH TIME ZONE,
1920
updated_at TIMESTAMP WITH TIME ZONE
2021
);
@@ -23,7 +24,7 @@ CREATE TABLE IF NOT EXISTS tap_horizon_ravs (
2324
-- Used for logging and debugging purposes.
2425
CREATE TABLE IF NOT EXISTS tap_horizon_rav_requests_failed (
2526
id BIGSERIAL PRIMARY KEY,
26-
allocation_id CHAR(40) NOT NULL,
27+
collection_id CHAR(64) NOT NULL,
2728
payer CHAR(40) NOT NULL,
2829
data_service CHAR(40) NOT NULL,
2930
service_provider CHAR(40) NOT NULL,

0 commit comments

Comments
 (0)