mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-13 16:16:59 +02:00
DB preparation for 2FA and WebAuthn
Also database cleanup
This commit is contained in:
parent
b8345209eb
commit
fe39a693c7
2 changed files with 160 additions and 129 deletions
|
@ -174,17 +174,17 @@ CREATE TABLE IF NOT EXISTS `registry`.`statement` (
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='financial statement';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='financial statement';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`invoices` (
|
CREATE TABLE IF NOT EXISTS `registry`.`invoices` (
|
||||||
id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
`id` INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||||
invoice_number VARCHAR(20),
|
`invoice_number` VARCHAR(20),
|
||||||
registrar_id INT(10) UNSIGNED,
|
`registrar_id` INT(10) UNSIGNED,
|
||||||
billing_contact_id INT(10) UNSIGNED,
|
`billing_contact_id` INT(10) UNSIGNED,
|
||||||
issue_date DATETIME(3),
|
`issue_date` DATETIME(3),
|
||||||
due_date DATETIME(3) default NULL,
|
`due_date` DATETIME(3) default NULL,
|
||||||
total_amount DECIMAL(10,2),
|
`total_amount` DECIMAL(10,2),
|
||||||
payment_status ENUM('unpaid', 'paid', 'overdue', 'cancelled') DEFAULT 'unpaid',
|
`payment_status` ENUM('unpaid', 'paid', 'overdue', 'cancelled') DEFAULT 'unpaid',
|
||||||
notes TEXT default NULL,
|
`notes` TEXT default NULL,
|
||||||
created_at DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3),
|
`created_at` DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3),
|
||||||
updated_at DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
|
`updated_at` DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
|
||||||
FOREIGN KEY (registrar_id) REFERENCES registrar(id),
|
FOREIGN KEY (registrar_id) REFERENCES registrar(id),
|
||||||
FOREIGN KEY (billing_contact_id) REFERENCES registrar_contact(id)
|
FOREIGN KEY (billing_contact_id) REFERENCES registrar_contact(id)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='invoices';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='invoices';
|
||||||
|
@ -469,79 +469,95 @@ CREATE TABLE IF NOT EXISTS `registry`.`statistics` (
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Statistics';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Statistics';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`users` (
|
CREATE TABLE IF NOT EXISTS `registry`.`users` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`email` varchar(249) COLLATE utf8mb4_unicode_ci NOT NULL,
|
`email` varchar(249) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`password` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
`password` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
||||||
`username` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
`username` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||||
`status` tinyint(2) unsigned NOT NULL DEFAULT '0',
|
`status` tinyint(2) unsigned NOT NULL DEFAULT '0',
|
||||||
`verified` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
`verified` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||||
`resettable` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
`resettable` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
||||||
`roles_mask` int(10) unsigned NOT NULL DEFAULT '0',
|
`roles_mask` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`registered` int(10) unsigned NOT NULL,
|
`registered` int(10) unsigned NOT NULL,
|
||||||
`last_login` int(10) unsigned DEFAULT NULL,
|
`last_login` int(10) unsigned DEFAULT NULL,
|
||||||
`force_logout` mediumint(7) unsigned NOT NULL DEFAULT '0',
|
`force_logout` mediumint(7) unsigned NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`id`),
|
`tfa_secret` VARCHAR(32),
|
||||||
UNIQUE KEY `email` (`email`)
|
`tfa_enabled` TINYINT DEFAULT 0,
|
||||||
|
`auth_method` ENUM('password', '2fa', 'webauthn') DEFAULT 'password',
|
||||||
|
`backup_codes` TEXT,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `email` (`email`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`users_confirmations` (
|
CREATE TABLE IF NOT EXISTS `registry`.`users_confirmations` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`user_id` int(10) unsigned NOT NULL,
|
`user_id` int(10) unsigned NOT NULL,
|
||||||
`email` varchar(249) COLLATE utf8mb4_unicode_ci NOT NULL,
|
`email` varchar(249) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`selector` varchar(16) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
`selector` varchar(16) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
||||||
`token` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
`token` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
||||||
`expires` int(10) unsigned NOT NULL,
|
`expires` int(10) unsigned NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `selector` (`selector`),
|
UNIQUE KEY `selector` (`selector`),
|
||||||
KEY `email_expires` (`email`,`expires`),
|
KEY `email_expires` (`email`,`expires`),
|
||||||
KEY `user_id` (`user_id`)
|
KEY `user_id` (`user_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users Confirmations';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users Confirmations';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`users_remembered` (
|
CREATE TABLE IF NOT EXISTS `registry`.`users_remembered` (
|
||||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`user` int(10) unsigned NOT NULL,
|
`user` int(10) unsigned NOT NULL,
|
||||||
`selector` varchar(24) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
`selector` varchar(24) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
||||||
`token` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
`token` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
||||||
`expires` int(10) unsigned NOT NULL,
|
`expires` int(10) unsigned NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `selector` (`selector`),
|
UNIQUE KEY `selector` (`selector`),
|
||||||
KEY `user` (`user`)
|
KEY `user` (`user`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users Remember';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users Remember';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`users_resets` (
|
CREATE TABLE IF NOT EXISTS `registry`.`users_resets` (
|
||||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`user` int(10) unsigned NOT NULL,
|
`user` int(10) unsigned NOT NULL,
|
||||||
`selector` varchar(20) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
`selector` varchar(20) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
||||||
`token` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
`token` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
||||||
`expires` int(10) unsigned NOT NULL,
|
`expires` int(10) unsigned NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `selector` (`selector`),
|
UNIQUE KEY `selector` (`selector`),
|
||||||
KEY `user_expires` (`user`,`expires`)
|
KEY `user_expires` (`user`,`expires`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users Reset';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users Reset';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`users_throttling` (
|
CREATE TABLE IF NOT EXISTS `registry`.`users_throttling` (
|
||||||
`bucket` varchar(44) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
`bucket` varchar(44) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
||||||
`tokens` float unsigned NOT NULL,
|
`tokens` float unsigned NOT NULL,
|
||||||
`replenished_at` int(10) unsigned NOT NULL,
|
`replenished_at` int(10) unsigned NOT NULL,
|
||||||
`expires_at` int(10) unsigned NOT NULL,
|
`expires_at` int(10) unsigned NOT NULL,
|
||||||
PRIMARY KEY (`bucket`),
|
PRIMARY KEY (`bucket`),
|
||||||
KEY `expires_at` (`expires_at`)
|
KEY `expires_at` (`expires_at`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users Flags';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users Flags';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`users_webauthn` (
|
||||||
|
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`user_id` INT UNSIGNED NOT NULL,
|
||||||
|
`credential_id` VARBINARY(255) NOT NULL,
|
||||||
|
`public_key` TEXT NOT NULL,
|
||||||
|
`attestation_object` BLOB,
|
||||||
|
`sign_count` BIGINT NOT NULL,
|
||||||
|
`created_at` DATETIME(3) DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`last_used_at` DATETIME(3) DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
FOREIGN KEY (user_id) REFERENCES users(id)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users WebAuthn Data';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`registrar_users` (
|
CREATE TABLE IF NOT EXISTS `registry`.`registrar_users` (
|
||||||
`registrar_id` int(10) unsigned NOT NULL,
|
`registrar_id` int(10) unsigned NOT NULL,
|
||||||
`user_id` int(10) unsigned NOT NULL,
|
`user_id` int(10) unsigned NOT NULL,
|
||||||
PRIMARY KEY (`registrar_id`, `user_id`),
|
PRIMARY KEY (`registrar_id`, `user_id`),
|
||||||
FOREIGN KEY (`registrar_id`) REFERENCES `registrar`(`id`) ON DELETE CASCADE,
|
FOREIGN KEY (`registrar_id`) REFERENCES `registrar`(`id`) ON DELETE CASCADE,
|
||||||
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Linking Registrars with Panel Users';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Linking Registrars with Panel Users';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`urs_actions` (
|
CREATE TABLE IF NOT EXISTS `registry`.`urs_actions` (
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
domain_name VARCHAR(255) NOT NULL,
|
`domain_name` VARCHAR(255) NOT NULL,
|
||||||
urs_provider VARCHAR(255) NOT NULL,
|
`urs_provider` VARCHAR(255) NOT NULL,
|
||||||
action_date DATE NOT NULL,
|
`action_date` DATE NOT NULL,
|
||||||
status VARCHAR(255) NOT NULL
|
`status` VARCHAR(255) NOT NULL
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='URS Actions';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='URS Actions';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`rde_escrow_deposits` (
|
CREATE TABLE IF NOT EXISTS `registry`.`rde_escrow_deposits` (
|
||||||
|
@ -597,36 +613,36 @@ CREATE TABLE IF NOT EXISTS `registry`.`premium_domain_pricing` (
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Premium Domains';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Premium Domains';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`ticket_categories` (
|
CREATE TABLE IF NOT EXISTS `registry`.`ticket_categories` (
|
||||||
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
`id` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||||
name VARCHAR(255) NOT NULL,
|
`name` VARCHAR(255) NOT NULL,
|
||||||
description TEXT
|
`description` TEXT
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Ticket Categories';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Ticket Categories';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`support_tickets` (
|
CREATE TABLE IF NOT EXISTS `registry`.`support_tickets` (
|
||||||
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
`id` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||||
user_id INT(11) UNSIGNED NOT NULL,
|
`user_id` INT(11) UNSIGNED NOT NULL,
|
||||||
category_id INT(11) UNSIGNED NOT NULL,
|
`category_id` INT(11) UNSIGNED NOT NULL,
|
||||||
subject VARCHAR(255) NOT NULL,
|
`subject` VARCHAR(255) NOT NULL,
|
||||||
message TEXT NOT NULL,
|
`message` TEXT NOT NULL,
|
||||||
status ENUM('Open', 'In Progress', 'Resolved', 'Closed') DEFAULT 'Open',
|
`status` ENUM('Open', 'In Progress', 'Resolved', 'Closed') DEFAULT 'Open',
|
||||||
priority ENUM('Low', 'Medium', 'High', 'Critical') DEFAULT 'Medium',
|
`priority` ENUM('Low', 'Medium', 'High', 'Critical') DEFAULT 'Medium',
|
||||||
reported_domain VARCHAR(255) DEFAULT NULL,
|
`reported_domain` VARCHAR(255) DEFAULT NULL,
|
||||||
nature_of_abuse TEXT DEFAULT NULL,
|
`nature_of_abuse` TEXT DEFAULT NULL,
|
||||||
evidence TEXT DEFAULT NULL,
|
`evidence` TEXT DEFAULT NULL,
|
||||||
relevant_urls TEXT DEFAULT NULL,
|
`relevant_urls` TEXT DEFAULT NULL,
|
||||||
date_of_incident DATE DEFAULT NULL,
|
`date_of_incident` DATE DEFAULT NULL,
|
||||||
date_created datetime(3) DEFAULT CURRENT_TIMESTAMP,
|
`date_created` datetime(3) DEFAULT CURRENT_TIMESTAMP,
|
||||||
last_updated datetime(3) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`last_updated` datetime(3) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
FOREIGN KEY (user_id) REFERENCES users(id),
|
FOREIGN KEY (user_id) REFERENCES users(id),
|
||||||
FOREIGN KEY (category_id) REFERENCES ticket_categories(id)
|
FOREIGN KEY (category_id) REFERENCES ticket_categories(id)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Support Tickets';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Support Tickets';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`ticket_responses` (
|
CREATE TABLE IF NOT EXISTS `registry`.`ticket_responses` (
|
||||||
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
`id` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||||
ticket_id INT(11) UNSIGNED NOT NULL,
|
`ticket_id` INT(11) UNSIGNED NOT NULL,
|
||||||
responder_id INT(11) UNSIGNED NOT NULL,
|
`responder_id` INT(11) UNSIGNED NOT NULL,
|
||||||
response TEXT NOT NULL,
|
`response` TEXT NOT NULL,
|
||||||
date_created datetime(3) DEFAULT CURRENT_TIMESTAMP,
|
`date_created` datetime(3) DEFAULT CURRENT_TIMESTAMP,
|
||||||
FOREIGN KEY (ticket_id) REFERENCES support_tickets(id)
|
FOREIGN KEY (ticket_id) REFERENCES support_tickets(id)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Ticket Responses';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Ticket Responses';
|
||||||
|
|
||||||
|
|
|
@ -179,18 +179,17 @@ CREATE TABLE registry.statement (
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE registry.invoices (
|
CREATE TABLE registry.invoices (
|
||||||
id SERIAL PRIMARY KEY,
|
"id" SERIAL PRIMARY KEY,
|
||||||
invoice_number VARCHAR(20),
|
"invoice_number" VARCHAR(20),
|
||||||
registrar_id INT,
|
"registrar_id" INT,
|
||||||
billing_contact_id INT,
|
"billing_contact_id" INT,
|
||||||
issue_date TIMESTAMP(3),
|
"issue_date" TIMESTAMP(3),
|
||||||
due_date TIMESTAMP(3) DEFAULT NULL,
|
"due_date" TIMESTAMP(3) DEFAULT NULL,
|
||||||
total_amount NUMERIC(10,2),
|
"total_amount" NUMERIC(10,2),
|
||||||
payment_status VARCHAR(10) DEFAULT 'unpaid' CHECK (payment_status IN ('unpaid', 'paid', 'overdue', 'cancelled')),
|
"payment_status" VARCHAR(10) DEFAULT 'unpaid' CHECK (payment_status IN ('unpaid', 'paid', 'overdue', 'cancelled')),
|
||||||
notes TEXT DEFAULT NULL,
|
"notes" TEXT DEFAULT NULL,
|
||||||
created_at TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
"created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
||||||
updated_at TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
"updated_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
|
||||||
FOREIGN KEY (registrar_id) REFERENCES registrar(id),
|
FOREIGN KEY (registrar_id) REFERENCES registrar(id),
|
||||||
FOREIGN KEY (billing_contact_id) REFERENCES registrar_contact(id)
|
FOREIGN KEY (billing_contact_id) REFERENCES registrar_contact(id)
|
||||||
);
|
);
|
||||||
|
@ -445,7 +444,7 @@ CREATE TABLE registry.statistics (
|
||||||
"deleted_domains" int CHECK ("deleted_domains" >= 0) NOT NULL DEFAULT '0',
|
"deleted_domains" int CHECK ("deleted_domains" >= 0) NOT NULL DEFAULT '0',
|
||||||
"restored_domains" int CHECK ("restored_domains" >= 0) NOT NULL DEFAULT '0',
|
"restored_domains" int CHECK ("restored_domains" >= 0) NOT NULL DEFAULT '0',
|
||||||
primary key ("id"),
|
primary key ("id"),
|
||||||
unique ("date")
|
unique ("date")
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS registry.users (
|
CREATE TABLE IF NOT EXISTS registry.users (
|
||||||
|
@ -459,7 +458,11 @@ CREATE TABLE IF NOT EXISTS registry.users (
|
||||||
"roles_mask" INTEGER NOT NULL DEFAULT '0' CHECK ("roles_mask" >= 0),
|
"roles_mask" INTEGER NOT NULL DEFAULT '0' CHECK ("roles_mask" >= 0),
|
||||||
"registered" INTEGER NOT NULL CHECK ("registered" >= 0),
|
"registered" INTEGER NOT NULL CHECK ("registered" >= 0),
|
||||||
"last_login" INTEGER DEFAULT NULL CHECK ("last_login" >= 0),
|
"last_login" INTEGER DEFAULT NULL CHECK ("last_login" >= 0),
|
||||||
"force_logout" INTEGER NOT NULL DEFAULT '0' CHECK ("force_logout" >= 0)
|
"force_logout" INTEGER NOT NULL DEFAULT '0' CHECK ("force_logout" >= 0),
|
||||||
|
"tfa_secret" VARCHAR(32),
|
||||||
|
"tfa_enabled" BOOLEAN DEFAULT false,
|
||||||
|
"auth_method" VARCHAR(255) DEFAULT 'password',
|
||||||
|
"backup_codes" TEXT,
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS registry.users_confirmations (
|
CREATE TABLE IF NOT EXISTS registry.users_confirmations (
|
||||||
|
@ -499,12 +502,24 @@ CREATE TABLE IF NOT EXISTS registry.users_throttling (
|
||||||
);
|
);
|
||||||
CREATE INDEX IF NOT EXISTS "expires_at" ON registry.users_throttling ("expires_at");
|
CREATE INDEX IF NOT EXISTS "expires_at" ON registry.users_throttling ("expires_at");
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS registry.users_webauthn (
|
||||||
|
"id" SERIAL PRIMARY KEY,
|
||||||
|
"user_id" INTEGER NOT NULL,
|
||||||
|
"credential_id" BYTEA NOT NULL,
|
||||||
|
"public_key" TEXT NOT NULL,
|
||||||
|
"attestation_object" BYTEA,
|
||||||
|
"sign_count" BIGINT NOT NULL,
|
||||||
|
"created_at" TIMESTAMP(3) WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"last_used_at" TIMESTAMP(3) WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
FOREIGN KEY (user_id) REFERENCES users(id)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS registry.registrar_users (
|
CREATE TABLE IF NOT EXISTS registry.registrar_users (
|
||||||
registrar_id int NOT NULL,
|
"registrar_id" int NOT NULL,
|
||||||
user_id int NOT NULL,
|
"user_id" int NOT NULL,
|
||||||
PRIMARY KEY (registrar_id, user_id),
|
"PRIMARY KEY" (registrar_id, user_id),
|
||||||
FOREIGN KEY (registrar_id) REFERENCES registrar(id) ON DELETE CASCADE,
|
"FOREIGN KEY" (registrar_id) REFERENCES registrar(id) ON DELETE CASCADE,
|
||||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
"FOREIGN KEY" (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||||
) WITH (OIDS=FALSE);
|
) WITH (OIDS=FALSE);
|
||||||
COMMENT ON TABLE registrar_users IS 'Linking Registrars with Panel Users';
|
COMMENT ON TABLE registrar_users IS 'Linking Registrars with Panel Users';
|
||||||
|
|
||||||
|
@ -580,36 +595,36 @@ CREATE TYPE ticket_status AS ENUM ('Open', 'In Progress', 'Resolved', 'Closed');
|
||||||
CREATE TYPE ticket_priority AS ENUM ('Low', 'Medium', 'High', 'Critical');
|
CREATE TYPE ticket_priority AS ENUM ('Low', 'Medium', 'High', 'Critical');
|
||||||
|
|
||||||
CREATE TABLE registry.ticket_categories (
|
CREATE TABLE registry.ticket_categories (
|
||||||
id SERIAL PRIMARY KEY,
|
"id" SERIAL PRIMARY KEY,
|
||||||
name VARCHAR(255) NOT NULL,
|
"name" VARCHAR(255) NOT NULL,
|
||||||
description TEXT
|
"description" TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE registry.support_tickets (
|
CREATE TABLE registry.support_tickets (
|
||||||
id SERIAL PRIMARY KEY,
|
"id" SERIAL PRIMARY KEY,
|
||||||
user_id INTEGER NOT NULL,
|
"user_id" INTEGER NOT NULL,
|
||||||
category_id INTEGER NOT NULL,
|
"category_id" INTEGER NOT NULL,
|
||||||
subject VARCHAR(255) NOT NULL,
|
"subject" VARCHAR(255) NOT NULL,
|
||||||
message TEXT NOT NULL,
|
"message" TEXT NOT NULL,
|
||||||
status ticket_status DEFAULT 'Open',
|
"status" ticket_status DEFAULT 'Open',
|
||||||
priority ticket_priority DEFAULT 'Medium',
|
"priority" ticket_priority DEFAULT 'Medium',
|
||||||
reported_domain VARCHAR(255) DEFAULT NULL,
|
"reported_domain" VARCHAR(255) DEFAULT NULL,
|
||||||
nature_of_abuse TEXT DEFAULT NULL,
|
"nature_of_abuse" TEXT DEFAULT NULL,
|
||||||
evidence TEXT DEFAULT NULL,
|
"evidence" TEXT DEFAULT NULL,
|
||||||
relevant_urls TEXT DEFAULT NULL,
|
"relevant_urls" TEXT DEFAULT NULL,
|
||||||
date_of_incident DATE DEFAULT NULL,
|
"date_of_incident" DATE DEFAULT NULL,
|
||||||
date_created TIMESTAMP(3) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
"date_created" TIMESTAMP(3) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||||
last_updated TIMESTAMP(3) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
"last_updated" TIMESTAMP(3) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||||
FOREIGN KEY (user_id) REFERENCES registry.users(id),
|
FOREIGN KEY (user_id) REFERENCES registry.users(id),
|
||||||
FOREIGN KEY (category_id) REFERENCES registry.ticket_categories(id)
|
FOREIGN KEY (category_id) REFERENCES registry.ticket_categories(id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE ticket_responses (
|
CREATE TABLE ticket_responses (
|
||||||
id SERIAL PRIMARY KEY,
|
"id" SERIAL PRIMARY KEY,
|
||||||
ticket_id INTEGER NOT NULL,
|
"ticket_id" INTEGER NOT NULL,
|
||||||
responder_id INTEGER NOT NULL,
|
"responder_id" INTEGER NOT NULL,
|
||||||
response TEXT NOT NULL,
|
"response" TEXT NOT NULL,
|
||||||
date_created TIMESTAMP(3) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
"date_created" TIMESTAMP(3) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||||
FOREIGN KEY (ticket_id) REFERENCES support_tickets(id)
|
FOREIGN KEY (ticket_id) REFERENCES support_tickets(id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue