Chimanos
05/09/2023, 12:31 PM5.0
); and am getting :
Unknown column 'use_static_key' in 'field list'
rp
05/09/2023, 12:36 PMChimanos
05/09/2023, 12:46 PMrp
05/09/2023, 12:46 PMChimanos
05/09/2023, 12:59 PMsql
use_static_key BOOLEAN NOT NULL,
whereas the migration propose setting the default to false
/ true
depending on the access_token_signing_key_dynamic
config.
This leads to a database structure state which is different if created from scratch or migrated. If a further INSERT omits the use_static_key
column for some reason; the behaviors will be different.
I understand why it's set up like so (to auto-migrate the nullish columns); but I believe this DEFAULT
could/should be dropped afterward :
sql
ALTER TABLE session_info ADD COLUMN use_static_key BOOLEAN NOT NULL DEFAULT(false);
ALTER TABLE session_info ALTER COLUMN use_static_key DROP DEFAULT;
(untested)rp
05/09/2023, 1:17 PMChimanos
05/09/2023, 1:32 PMsql
CREATE TABLE IF NOT EXISTS totp_users (
user_id VARCHAR(128) NOT NULL,
PRIMARY KEY (user_id)
);
CREATE TABLE IF NOT EXISTS totp_user_devices (
user_id VARCHAR(128) NOT NULL,
device_name VARCHAR(256) NOT NULL,
secret_key VARCHAR(256) NOT NULL,
period INTEGER NOT NULL,
skew INTEGER NOT NULL,
verified BOOLEAN NOT NULL,
PRIMARY KEY (user_id, device_name),
FOREIGN KEY (user_id) REFERENCES totp_users(user_id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS totp_used_codes (
user_id VARCHAR(128) NOT NULL,
code VARCHAR(8) NOT NULL,
is_valid BOOLEAN NOT NULL,
expiry_time_ms BIGINT UNSIGNED NOT NULL,
created_time_ms BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (user_id, created_time_ms),
FOREIGN KEY (user_id) REFERENCES totp_users(user_id) ON DELETE CASCADE
);
CREATE INDEX totp_used_codes_expiry_time_ms_index ON totp_used_codes(expiry_time_ms);
rp
05/09/2023, 3:37 PM