sqlite: move migration after table creation

Otherwise we'll fail immediately as the schema version is returned as 0.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg 2023-02-23 09:43:24 +01:00
parent eeabe975ea
commit 8c64c4370f
1 changed files with 4 additions and 4 deletions

View File

@ -64,15 +64,15 @@ func NewSqliteState(runtime *Runtime) (_ State, defErr error) {
return nil, fmt.Errorf("setting full fsync mode in db: %w", err)
}
if err := state.migrateSchemaIfNecessary(); err != nil {
return nil, err
}
// Set up tables
if err := sqliteInitTables(state.conn); err != nil {
return nil, fmt.Errorf("creating tables: %w", err)
}
if err := state.migrateSchemaIfNecessary(); err != nil {
return nil, err
}
state.valid = true
state.runtime = runtime