init push
This commit is contained in:
24
migrations/20260518_user_email_login_otps.sql
Normal file
24
migrations/20260518_user_email_login_otps.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE IF NOT EXISTS user_email_login_otps (
|
||||
id BINARY(16) NOT NULL,
|
||||
user_id BINARY(16) NOT NULL,
|
||||
otp_hash BINARY(32) NOT NULL,
|
||||
expires_at DATETIME(6) NOT NULL,
|
||||
used_at DATETIME(6) NULL,
|
||||
attempt_count INT NOT NULL DEFAULT 0,
|
||||
max_attempts INT NOT NULL DEFAULT 5,
|
||||
resend_count INT NOT NULL DEFAULT 1,
|
||||
last_sent_at DATETIME(6) NOT NULL,
|
||||
created_at DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||
created_by BINARY(16) NULL,
|
||||
updated_at DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
updated_by BINARY(16) NULL,
|
||||
PRIMARY KEY (id),
|
||||
KEY idx_user_email_login_otps_user_id (user_id),
|
||||
KEY idx_user_email_login_otps_expires_at (expires_at),
|
||||
KEY idx_user_email_login_otps_used_at (used_at),
|
||||
CONSTRAINT fk_user_email_login_otps_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE IF EXISTS user_email_login_otps;
|
||||
Reference in New Issue
Block a user