@@ -81,6 +81,12 @@ func (m *dbMigration) migrateEventStream(ctx context.Context, es *apitypes.Event
81
81
return err
82
82
}
83
83
if existingES == nil {
84
+ if es .Created == nil {
85
+ es .Created = fftypes .Now ()
86
+ }
87
+ if es .Updated == nil {
88
+ es .Updated = es .Created
89
+ }
84
90
log .L (ctx ).Infof ("Writing event stream %s to target" , es .ID )
85
91
if err := m .target .WriteStream (ctx , es ); err != nil {
86
92
return err
@@ -96,6 +102,13 @@ func (m *dbMigration) migrateEventStream(ctx context.Context, es *apitypes.Event
96
102
return err
97
103
}
98
104
if cp != nil && existingCP == nil {
105
+ // LevelDB didn't have timestamps in checkpoints
106
+ if cp .FirstCheckpoint == nil {
107
+ cp .FirstCheckpoint = fftypes .Now ()
108
+ }
109
+ if cp .Time == nil {
110
+ cp .Time = cp .FirstCheckpoint
111
+ }
99
112
log .L (ctx ).Infof ("Writing checkpoint %s to target" , cp .StreamID )
100
113
if err := m .target .WriteCheckpoint (ctx , cp ); err != nil {
101
114
return err
@@ -138,6 +151,12 @@ func (m *dbMigration) migrateListener(ctx context.Context, l *apitypes.Listener)
138
151
}
139
152
if existingL == nil {
140
153
log .L (ctx ).Infof ("Writing listener %s to target" , l .ID )
154
+ if l .Created == nil {
155
+ l .Created = fftypes .Now ()
156
+ }
157
+ if l .Updated == nil {
158
+ l .Updated = l .Created
159
+ }
141
160
if err := m .target .WriteListener (ctx , l ); err != nil {
142
161
return err
143
162
}
@@ -185,6 +204,12 @@ func (m *dbMigration) migrateTransaction(ctx context.Context, mtx *apitypes.Mana
185
204
}
186
205
if existingTX == nil {
187
206
log .L (ctx ).Infof ("Writing transaction %s to target" , tx .ID )
207
+ if tx .Created == nil {
208
+ tx .Created = fftypes .Now ()
209
+ }
210
+ if tx .Updated == nil {
211
+ tx .Updated = tx .Created
212
+ }
188
213
if err := m .target .InsertTransactionPreAssignedNonce (ctx , tx .ManagedTX ); err != nil {
189
214
return err
190
215
}
0 commit comments