Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 8a7efbf

Browse files
[Backport 5.3] Migrator Backfill Override (#60651)
1 parent ff31bf2 commit 8a7efbf

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

internal/database/migration/store/store.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ func (s *Store) EnsureSchemaTable(ctx context.Context) (err error) {
9393
return nil
9494
}
9595

96+
// backfillOverrides contains a list of migration IDs that are to be backfilled
97+
// after the stitched-migration graph has already been constructed.
98+
var backfillOverrides = []int64{
99+
1648115472, // See https://github.com/sourcegraph/sourcegraph/pull/46969 and https://github.com/sourcegraph/sourcegraph/pull/55650
100+
}
101+
96102
// BackfillSchemaVersions adds "backfilled" rows into the migration_logs table to make instances
97103
// upgraded from older versions work uniformly with instances booted from a newer version.
98104
//
@@ -171,7 +177,12 @@ func (s *Store) BackfillSchemaVersions(ctx context.Context) error {
171177
if err != nil {
172178
return err
173179
}
180+
174181
idsToBackfill := []int64{}
182+
for _, id := range backfillOverrides {
183+
idsToBackfill = append(idsToBackfill, int64(id))
184+
}
185+
175186
for _, id := range ancestorIDs {
176187
idsToBackfill = append(idsToBackfill, int64(id))
177188
}

internal/database/migration/store/store_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ func testBackfillSchemaVersion(
127127
}
128128

129129
sort.Ints(appliedVersions)
130+
for _, version := range backfillOverrides {
131+
expectedVersions = append(expectedVersions, int(version))
132+
}
130133
sort.Ints(expectedVersions)
131134
if diff := cmp.Diff(expectedVersions, appliedVersions); diff != "" {
132135
t.Errorf("unexpected applied migrations (-want +got):\n%s", diff)

0 commit comments

Comments
 (0)