1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-18 11:46:23 -07:00

Start implementing in-place migration for pre2021

This commit is contained in:
Eggbertx 2025-01-19 15:04:03 -08:00
parent 1463bbaa63
commit e2b5883e51
3 changed files with 7 additions and 5 deletions

View file

@ -22,8 +22,10 @@ type migrationSection struct {
}
func (m *Pre2021Migrator) migrateSectionsInPlace() error {
err := common.NewMigrationError("pre2021", "migrateSectionsInPlace not implemented")
common.LogError().Err(err).Caller().Msg("Failed to migrate sections")
_, err := m.db.ExecSQL(`ALTER TABLE DBPREFIXsections RENAME COLUMN list_order TO position`)
if err != nil {
common.LogError().Caller().Msg("Failed to rename list_order column to position")
}
return err
}

View file

@ -73,7 +73,7 @@ func TestMigrateBoardsInPlace(t *testing.T) {
t.FailNow()
}
if !assert.Error(t, migrator.MigrateBoards(), "Not yet implemented") {
if !assert.NoError(t, migrator.MigrateBoards()) {
t.FailNow()
}
}

View file

@ -50,8 +50,8 @@ func setupMigrationTest(t *testing.T, outDir string, migrateInPlace bool) *Pre20
}
assert.NoError(t, oldDbFile.Close())
assert.NoError(t, newDbFile.Close())
migratedDBHost = dbHost
migratedDBName = dbName
dbHost = migratedDBHost
dbName = migratedDBName
}
oldSQLConfig := config.SQLConfig{