Skip to content

Commit bb29ae3

Browse files
authored
Nullable InteropTransfer columns (l2beat#11377)
1 parent 285ad95 commit bb29ae3

File tree

3 files changed

+32
-9
lines changed

3 files changed

+32
-9
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- AlterTable
2+
ALTER TABLE "InteropTransfer" ALTER COLUMN "duration" DROP NOT NULL,
3+
ALTER COLUMN "srcTime" DROP NOT NULL,
4+
ALTER COLUMN "srcTxHash" DROP NOT NULL,
5+
ALTER COLUMN "srcLogIndex" DROP NOT NULL,
6+
ALTER COLUMN "srcEventId" DROP NOT NULL,
7+
ALTER COLUMN "dstTime" DROP NOT NULL,
8+
ALTER COLUMN "dstTxHash" DROP NOT NULL,
9+
ALTER COLUMN "dstLogIndex" DROP NOT NULL,
10+
ALTER COLUMN "dstEventId" DROP NOT NULL;

packages/database/prisma/schema.prisma

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,13 @@ model InteropTransfer {
372372
bridgeType String? @db.VarChar(32)
373373
timestamp DateTime @db.Timestamp(6)
374374
375-
duration Int
375+
duration Int?
376376
377-
srcTime DateTime @db.Timestamp(6)
377+
srcTime DateTime? @db.Timestamp(6)
378378
srcChain String @db.VarChar(32)
379-
srcTxHash String @db.VarChar(66)
380-
srcLogIndex Int
381-
srcEventId String @db.VarChar(40)
379+
srcTxHash String? @db.VarChar(66)
380+
srcLogIndex Int?
381+
srcEventId String? @db.VarChar(40)
382382
srcTokenAddress String? @db.VarChar(66)
383383
srcRawAmount Decimal? @db.Decimal(80, 0)
384384
@@ -389,11 +389,11 @@ model InteropTransfer {
389389
srcValueUsd Float? @db.Real
390390
srcWasBurned Boolean?
391391
392-
dstTime DateTime @db.Timestamp(6)
392+
dstTime DateTime? @db.Timestamp(6)
393393
dstChain String @db.VarChar(32)
394-
dstTxHash String @db.VarChar(66)
395-
dstLogIndex Int
396-
dstEventId String @db.VarChar(40)
394+
dstTxHash String? @db.VarChar(66)
395+
dstLogIndex Int?
396+
dstEventId String? @db.VarChar(40)
397397
dstTokenAddress String? @db.VarChar(66)
398398
dstRawAmount Decimal? @db.Decimal(80, 0)
399399

packages/database/src/repositories/InteropTransferRepository.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,19 @@ export function toRecord(
9696
)
9797
}
9898

99+
// Remove me: Just to apply migration
100+
assert(row.duration !== null)
101+
102+
assert(row.srcTime !== null)
103+
assert(row.srcTxHash !== null)
104+
assert(row.srcEventId !== null)
105+
assert(row.srcLogIndex !== null)
106+
107+
assert(row.dstTime !== null)
108+
assert(row.dstTxHash !== null)
109+
assert(row.dstEventId !== null)
110+
assert(row.dstLogIndex !== null)
111+
99112
return {
100113
plugin: row.plugin,
101114
transferId: row.transferId,

0 commit comments

Comments
 (0)