2019-11-17 02:50:58 +07:00
|
|
|
package storage
|
|
|
|
|
2020-07-16 12:56:08 +07:00
|
|
|
import (
|
2021-11-23 16:45:38 +07:00
|
|
|
"regexp"
|
2020-07-16 12:56:08 +07:00
|
|
|
)
|
|
|
|
|
2021-11-23 16:45:38 +07:00
|
|
|
const (
|
|
|
|
tableUserPreferences = "user_preferences"
|
|
|
|
tableIdentityVerification = "identity_verification_tokens"
|
|
|
|
tableTOTPConfigurations = "totp_configurations"
|
|
|
|
tableU2FDevices = "u2f_devices"
|
|
|
|
tableDUODevices = "duo_devices"
|
|
|
|
tableAuthenticationLogs = "authentication_logs"
|
|
|
|
tableMigrations = "migrations"
|
2021-11-25 08:56:58 +07:00
|
|
|
tableEncryption = "encryption"
|
2021-11-23 16:45:38 +07:00
|
|
|
|
|
|
|
tablePrefixBackup = "_bkp_"
|
|
|
|
)
|
|
|
|
|
2021-11-25 08:56:58 +07:00
|
|
|
const (
|
|
|
|
encryptionNameCheck = "check"
|
|
|
|
)
|
|
|
|
|
2021-11-23 16:45:38 +07:00
|
|
|
// WARNING: Do not change/remove these consts. They are used for Pre1 migrations.
|
|
|
|
const (
|
|
|
|
tablePre1TOTPSecrets = "totp_secrets"
|
|
|
|
tablePre1Config = "config"
|
|
|
|
tablePre1IdentityVerificationTokens = "identity_verification_tokens"
|
|
|
|
tableAlphaAuthenticationLogs = "AuthenticationLogs"
|
|
|
|
tableAlphaIdentityVerificationTokens = "IdentityVerificationTokens"
|
|
|
|
tableAlphaPreferences = "Preferences"
|
|
|
|
tableAlphaPreferencesTableName = "PreferencesTableName"
|
|
|
|
tableAlphaSecondFactorPreferences = "SecondFactorPreferences"
|
|
|
|
tableAlphaTOTPSecrets = "TOTPSecrets"
|
|
|
|
tableAlphaU2FDeviceHandles = "U2FDeviceHandles"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
providerAll = "all"
|
|
|
|
providerMySQL = "mysql"
|
|
|
|
providerPostgres = "postgres"
|
|
|
|
providerSQLite = "sqlite"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
// This is the latest schema version for the purpose of tests.
|
|
|
|
testLatestVersion = 1
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
// SchemaLatest represents the value expected for a "migrate to latest" migration. It's the maximum 32bit signed integer.
|
|
|
|
SchemaLatest = 2147483647
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
reMigration = regexp.MustCompile(`^V(\d{4})\.([^.]+)\.(all|sqlite|postgres|mysql)\.(up|down)\.sql$`)
|
|
|
|
)
|