Skip to content

Commit 64d32f4

Browse files
authored
chore: Change the pkey of fevm_traces and refine the previous migration script (#1259)
1 parent 01a3ec2 commit 64d32f4

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

model/fevm/trace.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ type FEVMTrace struct {
1515
// Height message was executed at.
1616
Height int64 `pg:",pk,notnull,use_zero"`
1717
// StateRoot message was applied to.
18-
MessageStateRoot string `pg:",pk,notnull"`
18+
MessageStateRoot string `pg:",notnull"`
1919
// On-chain message triggering the message.
2020
MessageCid string `pg:",pk,notnull"`
2121
// On-chain message ETH transaction hash
2222
TransactionHash string `pg:",notnull"`
2323

2424
// Cid of the trace.
25-
TraceCid string `pg:",pk,notnull"`
25+
TraceCid string `pg:",notnull"`
2626
// ETH Address of the sender.
2727
From string `pg:",notnull"`
2828
// ETH Address of the receiver.
@@ -47,7 +47,7 @@ type FEVMTrace struct {
4747
// Returns value of message receipt encode in eth bytes.
4848
Returns string `pg:",notnull"`
4949
// Index indicating the order of the messages execution.
50-
Index uint64 `pg:",notnull,use_zero"`
50+
Index uint64 `pg:",pk,notnull,use_zero"`
5151
// Params contained in message.
5252
ParsedParams string `pg:",type:jsonb"`
5353
// Returns value of message receipt.

schemas/v1/30_fevm_actor_dumps.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ func init() {
1515
actor_name TEXT,
1616
PRIMARY KEY(height, actor_id, nonce)
1717
);
18-
CREATE INDEX fevm_actor_dumps_actor_id_idx ON {{ .SchemaName | default "public"}}.fevm_actor_dumps USING hash (actor_id);
19-
CREATE INDEX fevm_actor_dumps_eth_address_idx ON {{ .SchemaName | default "public"}}.fevm_actor_dumps USING hash (eth_address);
18+
CREATE INDEX IF NOT EXISTS fevm_actor_dumps_actor_id_idx ON {{ .SchemaName | default "public"}}.fevm_actor_dumps USING hash (actor_id);
19+
CREATE INDEX IF NOT EXISTS fevm_actor_dumps_eth_address_idx ON {{ .SchemaName | default "public"}}.fevm_actor_dumps USING hash (eth_address);
2020
`,
2121
)
2222
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package v1
2+
3+
func init() {
4+
patches.Register(
5+
32,
6+
`
7+
ALTER TABLE {{ .SchemaName | default "public"}}.fevm_traces DROP CONSTRAINT IF EXISTS fevm_traces_pkey CASCADE, ADD PRIMARY KEY(height, index, message_cid)
8+
`,
9+
)
10+
}

0 commit comments

Comments
 (0)