Add PnPaaS application and browser installer
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
-- Run once against an existing PnPaaS database.
|
||||
-- Existing active/suspended accounts remain unchanged.
|
||||
ALTER TABLE users
|
||||
MODIFY status ENUM('pending', 'active', 'suspended') NOT NULL DEFAULT 'pending';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS account_activation_tokens (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
user_id BIGINT UNSIGNED NOT NULL,
|
||||
token_hash CHAR(64) NOT NULL,
|
||||
expires_at DATETIME NOT NULL,
|
||||
used_at DATETIME NULL,
|
||||
requested_ip VARCHAR(45) NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uq_account_activation_token_hash (token_hash),
|
||||
KEY idx_account_activation_user (user_id),
|
||||
KEY idx_account_activation_expiry (expires_at),
|
||||
CONSTRAINT fk_account_activation_user FOREIGN KEY (user_id) REFERENCES users (id)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
@@ -0,0 +1,23 @@
|
||||
-- Add customer contract data fields to existing users.
|
||||
ALTER TABLE users
|
||||
ADD COLUMN IF NOT EXISTS first_name VARCHAR(100) NOT NULL DEFAULT '' AFTER email,
|
||||
ADD COLUMN IF NOT EXISTS last_name VARCHAR(100) NOT NULL DEFAULT '' AFTER first_name,
|
||||
ADD COLUMN IF NOT EXISTS street_address VARCHAR(180) NOT NULL DEFAULT '' AFTER last_name,
|
||||
ADD COLUMN IF NOT EXISTS postal_code VARCHAR(20) NOT NULL DEFAULT '' AFTER street_address,
|
||||
ADD COLUMN IF NOT EXISTS city VARCHAR(100) NOT NULL DEFAULT '' AFTER postal_code,
|
||||
ADD COLUMN IF NOT EXISTS country_code CHAR(2) NOT NULL DEFAULT 'AT' AFTER city;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_consents (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
user_id BIGINT UNSIGNED NOT NULL,
|
||||
consent_type ENUM('terms', 'privacy', 'withdrawal') NOT NULL,
|
||||
document_url VARCHAR(2048) NOT NULL,
|
||||
document_version VARCHAR(100) NULL,
|
||||
consented_at DATETIME NOT NULL,
|
||||
consent_ip VARCHAR(45) NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uq_user_consent_type (user_id, consent_type),
|
||||
KEY idx_user_consents_user (user_id),
|
||||
CONSTRAINT fk_user_consents_user FOREIGN KEY (user_id) REFERENCES users (id)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
Reference in New Issue
Block a user