mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
3695aa8140
This is a massive overhaul to the SQL Storage for Authelia. It facilitates a whole heap of utility commands to help manage the database, primary keys, ensures all database requests use a context for cancellations, and paves the way for a few other PR's which improve the database. Fixes #1337
45 lines
2.0 KiB
Go
45 lines
2.0 KiB
Go
package storage
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
var (
|
|
// ErrNoU2FDeviceHandle error thrown when no U2F device handle has been found in DB.
|
|
ErrNoU2FDeviceHandle = errors.New("no U2F device handle found")
|
|
|
|
// ErrNoTOTPSecret error thrown when no TOTP secret has been found in DB.
|
|
ErrNoTOTPSecret = errors.New("no TOTP secret registered")
|
|
|
|
// ErrNoAvailableMigrations is returned when no available migrations can be found.
|
|
ErrNoAvailableMigrations = errors.New("no available migrations")
|
|
|
|
// ErrSchemaAlreadyUpToDate is returned when the schema is already up to date.
|
|
ErrSchemaAlreadyUpToDate = errors.New("schema already up to date")
|
|
|
|
// ErrNoMigrationsFound is returned when no migrations were found.
|
|
ErrNoMigrationsFound = errors.New("no schema migrations found")
|
|
)
|
|
|
|
// Error formats for the storage provider.
|
|
const (
|
|
ErrFmtMigrateUpTargetLessThanCurrent = "schema up migration target version %d is less then the current version %d"
|
|
ErrFmtMigrateUpTargetGreaterThanLatest = "schema up migration target version %d is greater then the latest version %d which indicates it doesn't exist"
|
|
ErrFmtMigrateDownTargetGreaterThanCurrent = "schema down migration target version %d is greater than the current version %d"
|
|
ErrFmtMigrateDownTargetLessThanMinimum = "schema down migration target version %d is less than the minimum version"
|
|
ErrFmtMigrateAlreadyOnTargetVersion = "schema migration target version %d is the same current version %d"
|
|
)
|
|
|
|
const (
|
|
errFmtFailedMigration = "schema migration %d (%s) failed: %w"
|
|
errFmtFailedMigrationPre1 = "schema migration pre1 failed: %w"
|
|
errFmtSchemaCurrentGreaterThanLatestKnown = "current schema version is greater than the latest known schema " +
|
|
"version, you must downgrade to schema version %d before you can use this version of Authelia"
|
|
)
|
|
|
|
const (
|
|
logFmtMigrationFromTo = "Storage schema migration from %s to %s is being attempted"
|
|
logFmtMigrationComplete = "Storage schema migration from %s to %s is complete"
|
|
logFmtErrClosingConn = "Error occurred closing SQL connection: %v"
|
|
)
|