Release v2.11.1
This commit is contained in:
@@ -249,6 +249,9 @@ async function ensureSchema(pool, options) {
|
||||
token_url VARCHAR(1024) NULL,
|
||||
token_request_body_json MEDIUMTEXT NULL,
|
||||
token_response_path VARCHAR(255) NULL DEFAULT 'access_token',
|
||||
token_refresh_url VARCHAR(1024) NULL,
|
||||
token_refresh_request_body_json MEDIUMTEXT NULL,
|
||||
token_refresh_response_path VARCHAR(255) NULL DEFAULT 'refresh_token',
|
||||
token_header_name VARCHAR(255) NULL DEFAULT 'Authorization',
|
||||
token_header_prefix VARCHAR(64) NULL DEFAULT 'Bearer',
|
||||
items_path VARCHAR(255) NULL,
|
||||
@@ -343,11 +346,18 @@ async function ensureSchema(pool, options) {
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(255) NULL,
|
||||
username VARCHAR(255) NOT NULL UNIQUE,
|
||||
email VARCHAR(320) NULL,
|
||||
email_verified_at DATETIME NULL,
|
||||
pending_email VARCHAR(320) NULL,
|
||||
pending_email_token_hash CHAR(64) NULL,
|
||||
pending_email_expires_at DATETIME NULL,
|
||||
password_hash CHAR(64) NOT NULL,
|
||||
password_salt VARCHAR(64) NOT NULL,
|
||||
password_iterations INT NOT NULL,
|
||||
must_change_password TINYINT(1) NOT NULL DEFAULT 0,
|
||||
account_locked TINYINT(1) NOT NULL DEFAULT 0,
|
||||
last_login_at DATETIME NULL,
|
||||
last_login_ip VARCHAR(255) NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
created_by INT NULL,
|
||||
modified_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
@@ -355,6 +365,37 @@ async function ensureSchema(pool, options) {
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
`);
|
||||
|
||||
await pool.query(`
|
||||
CREATE TABLE IF NOT EXISTS a_account_tokens (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id INT NOT NULL,
|
||||
token_type VARCHAR(32) NOT NULL,
|
||||
token_hash CHAR(64) NOT NULL UNIQUE,
|
||||
expires_at DATETIME NOT NULL,
|
||||
used_at DATETIME NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_account_tokens_user FOREIGN KEY (user_id) REFERENCES a_users(id) ON DELETE CASCADE,
|
||||
INDEX idx_account_tokens_lookup (token_type, token_hash, expires_at),
|
||||
INDEX idx_account_tokens_user_type (user_id, token_type)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
`);
|
||||
|
||||
await pool.query(`
|
||||
CREATE TABLE IF NOT EXISTS a_user_invitations (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
email VARCHAR(320) NOT NULL,
|
||||
name VARCHAR(255) NULL,
|
||||
role_ids_json TEXT NOT NULL,
|
||||
token_hash CHAR(64) NOT NULL UNIQUE,
|
||||
expires_at DATETIME NOT NULL,
|
||||
used_at DATETIME NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
created_by INT NULL,
|
||||
INDEX idx_user_invitations_email (email, used_at, expires_at),
|
||||
INDEX idx_user_invitations_created_by (created_by, created_at)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
`);
|
||||
|
||||
await pool.query(`
|
||||
CREATE TABLE IF NOT EXISTS a_roles (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
|
||||
+61
-1
@@ -504,7 +504,10 @@ const VERSIONED_MIGRATIONS = [
|
||||
await ensureColumn(pool, 'i_api_sources', 'token_url', 'VARCHAR(1024) NULL', 'auth_header_value');
|
||||
await ensureColumn(pool, 'i_api_sources', 'token_request_body_json', 'MEDIUMTEXT NULL', 'token_url');
|
||||
await ensureColumn(pool, 'i_api_sources', 'token_response_path', "VARCHAR(255) NULL DEFAULT 'access_token'", 'token_request_body_json');
|
||||
await ensureColumn(pool, 'i_api_sources', 'token_header_name', "VARCHAR(255) NULL DEFAULT 'Authorization'", 'token_response_path');
|
||||
await ensureColumn(pool, 'i_api_sources', 'token_refresh_url', 'VARCHAR(1024) NULL', 'token_response_path');
|
||||
await ensureColumn(pool, 'i_api_sources', 'token_refresh_request_body_json', 'MEDIUMTEXT NULL', 'token_refresh_url');
|
||||
await ensureColumn(pool, 'i_api_sources', 'token_refresh_response_path', "VARCHAR(255) NULL DEFAULT 'refresh_token'", 'token_refresh_request_body_json');
|
||||
await ensureColumn(pool, 'i_api_sources', 'token_header_name', "VARCHAR(255) NULL DEFAULT 'Authorization'", 'token_refresh_response_path');
|
||||
await ensureColumn(pool, 'i_api_sources', 'token_header_prefix', "VARCHAR(64) NULL DEFAULT 'Bearer'", 'token_header_name');
|
||||
}
|
||||
},
|
||||
@@ -561,6 +564,63 @@ const VERSIONED_MIGRATIONS = [
|
||||
run: async function (pool) {
|
||||
await ensureColumn(pool, 'd_onboarding_devices', 'last_seen_at', 'TIMESTAMP NULL', 'screen_id');
|
||||
}
|
||||
},
|
||||
{
|
||||
version: '2.10.7',
|
||||
label: 'v2.10.7 API token refresh settings schema',
|
||||
run: async function (pool) {
|
||||
await ensureColumn(pool, 'i_api_sources', 'token_refresh_url', 'VARCHAR(1024) NULL', 'token_response_path');
|
||||
await ensureColumn(pool, 'i_api_sources', 'token_refresh_request_body_json', 'MEDIUMTEXT NULL', 'token_refresh_url');
|
||||
await ensureColumn(pool, 'i_api_sources', 'token_refresh_response_path', "VARCHAR(255) NULL DEFAULT 'refresh_token'", 'token_refresh_request_body_json');
|
||||
}
|
||||
},
|
||||
{
|
||||
version: '2.11.0',
|
||||
label: 'v2.11.0 account email and password reset schema',
|
||||
run: async function (pool) {
|
||||
await ensureColumn(pool, 'a_users', 'email', 'VARCHAR(320) NULL', 'username');
|
||||
await ensureColumn(pool, 'a_users', 'email_verified_at', 'DATETIME NULL', 'email');
|
||||
await ensureColumn(pool, 'a_users', 'pending_email', 'VARCHAR(320) NULL', 'email_verified_at');
|
||||
await ensureColumn(pool, 'a_users', 'pending_email_token_hash', 'CHAR(64) NULL', 'pending_email');
|
||||
await ensureColumn(pool, 'a_users', 'pending_email_expires_at', 'DATETIME NULL', 'pending_email_token_hash');
|
||||
await ensureColumn(pool, 'a_users', 'last_login_at', 'DATETIME NULL', 'modified_by');
|
||||
await ensureColumn(pool, 'a_users', 'last_login_ip', 'VARCHAR(255) NULL', 'last_login_at');
|
||||
await pool.query(`
|
||||
CREATE TABLE IF NOT EXISTS a_account_tokens (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id INT NOT NULL,
|
||||
token_type VARCHAR(32) NOT NULL,
|
||||
token_hash CHAR(64) NOT NULL UNIQUE,
|
||||
expires_at DATETIME NOT NULL,
|
||||
used_at DATETIME NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_account_tokens_user FOREIGN KEY (user_id) REFERENCES a_users(id) ON DELETE CASCADE,
|
||||
INDEX idx_account_tokens_lookup (token_type, token_hash, expires_at),
|
||||
INDEX idx_account_tokens_user_type (user_id, token_type)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
`);
|
||||
}
|
||||
},
|
||||
{
|
||||
version: '2.11.1',
|
||||
label: 'v2.11.1 user invitations schema',
|
||||
run: async function (pool) {
|
||||
await pool.query(`
|
||||
CREATE TABLE IF NOT EXISTS a_user_invitations (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
email VARCHAR(320) NOT NULL,
|
||||
name VARCHAR(255) NULL,
|
||||
role_ids_json TEXT NOT NULL,
|
||||
token_hash CHAR(64) NOT NULL UNIQUE,
|
||||
expires_at DATETIME NOT NULL,
|
||||
used_at DATETIME NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
created_by INT NULL,
|
||||
INDEX idx_user_invitations_email (email, used_at, expires_at),
|
||||
INDEX idx_user_invitations_created_by (created_by, created_at)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
`);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user