diff options
Diffstat (limited to 'libpod/sql_state.go')
-rw-r--r-- | libpod/sql_state.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libpod/sql_state.go b/libpod/sql_state.go index 8b18a8959..7c2061fca 100644 --- a/libpod/sql_state.go +++ b/libpod/sql_state.go @@ -14,6 +14,10 @@ import ( _ "github.com/mattn/go-sqlite3" ) +// DBSchema is the current DB schema version +// Increments every time a change is made to the database's tables +const DBSchema = 1 + // SQLState is a state implementation backed by a persistent SQLite3 database type SQLState struct { db *sql.DB @@ -69,6 +73,11 @@ func NewSQLState(dbPath, lockPath, specsDir string, runtime *Runtime) (State, er return nil, err } + // Ensure that the database matches our config + if err := checkDB(db, runtime); err != nil { + return nil, err + } + state.db = db state.valid = true |