Phase1 Bearbeitung
This commit is contained in:
+31
-1
@@ -7,6 +7,36 @@ CREATE TABLE IF NOT EXISTS users (
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS password_reset_tokens (
|
||||
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id BIGINT UNSIGNED NOT NULL,
|
||||
email VARCHAR(190) NOT NULL,
|
||||
token_hash CHAR(64) NOT NULL UNIQUE,
|
||||
requested_ip_hash CHAR(64) NULL,
|
||||
requested_user_agent_hash CHAR(64) NULL,
|
||||
expires_at DATETIME NOT NULL,
|
||||
consumed_at DATETIME NULL,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
INDEX idx_password_reset_user_created (user_id, created_at),
|
||||
INDEX idx_password_reset_expires (expires_at),
|
||||
CONSTRAINT fk_password_reset_tokens_user FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rate_limits (
|
||||
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
action_key VARCHAR(80) NOT NULL,
|
||||
bucket_key CHAR(64) NOT NULL,
|
||||
attempts INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
window_start DATETIME NOT NULL,
|
||||
last_attempt_at DATETIME NOT NULL,
|
||||
blocked_until DATETIME NULL,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
UNIQUE KEY uniq_rate_limit_bucket (action_key, bucket_key),
|
||||
INDEX idx_rate_limit_blocked_until (blocked_until),
|
||||
INDEX idx_rate_limit_last_attempt (last_attempt_at)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS tenants (
|
||||
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(190) NOT NULL,
|
||||
@@ -57,7 +87,7 @@ CREATE TABLE IF NOT EXISTS members (
|
||||
user_id BIGINT UNSIGNED NULL,
|
||||
display_name VARCHAR(160) NOT NULL,
|
||||
email VARCHAR(190) NULL,
|
||||
access_pin VARCHAR(20) NULL,
|
||||
access_pin VARCHAR(255) NULL,
|
||||
status ENUM('active', 'archived') NOT NULL DEFAULT 'active',
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE KEY uniq_member_email (tenant_id, email),
|
||||
|
||||
Reference in New Issue
Block a user