Update in DB

This commit is contained in:
Pinga 2023-12-14 10:12:51 +02:00
parent e00a2985e9
commit a7bd8fc5fd
2 changed files with 46 additions and 25 deletions

View file

@ -81,6 +81,7 @@ CREATE TABLE IF NOT EXISTS `registry`.`registrar` (
`creditThreshold` decimal(12,2) NOT NULL default '0.00',
`thresholdType` enum('fixed','percent') NOT NULL default 'fixed',
`currency` varchar(5) NOT NULL default 'USD',
`vat_number` varchar(30) DEFAULT NULL,
`crdate` datetime(3) NOT NULL,
`lastupdate` TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
@ -592,15 +593,28 @@ CREATE TABLE IF NOT EXISTS `registry`.`icann_reports` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='ICANN Reporting';
CREATE TABLE IF NOT EXISTS `registry`.`promotion_pricing` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`tld_id` INT UNSIGNED,
`promo_name` VARCHAR(255) NOT NULL,
`start_date` DATE NOT NULL,
`end_date` DATE NOT NULL,
`discount_percentage` DECIMAL(5,2),
`discount_amount` DECIMAL(10,2),
`description` TEXT,
`conditions` TEXT,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
`tld_id` int(10) unsigned DEFAULT NULL,
`promo_name` varchar(255) NOT NULL,
`start_date` datetime(3) NOT NULL,
`end_date` datetime(3) NOT NULL,
`discount_percentage` decimal(5,2) DEFAULT NULL,
`discount_amount` decimal(10,2) DEFAULT NULL,
`description` text DEFAULT NULL,
`conditions` text DEFAULT NULL,
`promo_type` ENUM('full', 'registration', 'renewal', 'transfer') NOT NULL,
`years_of_promotion` int(2) DEFAULT NULL,
`max_count` int(10) unsigned DEFAULT NULL,
`registrar_ids` json DEFAULT NULL,
`status` ENUM('active', 'expired', 'upcoming') NOT NULL,
`minimum_purchase` decimal(10,2) DEFAULT NULL,
`target_segment` varchar(255) DEFAULT NULL,
`region_specific` varchar(255) DEFAULT NULL,
`created_by` varchar(255) DEFAULT NULL,
`created_at` datetime(3) DEFAULT NULL,
`updated_by` varchar(255) DEFAULT NULL,
`updated_at` datetime(3) DEFAULT NULL,
KEY `tld_id` (`tld_id`),
FOREIGN KEY (`tld_id`) REFERENCES `domain_tld`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Promotions';
@ -704,14 +718,6 @@ INSERT INTO `registry`.`settings` (`name`, `value`) VALUES
('handle', 'RXX'),
('email', 'contact@example.com');
CREATE USER 'registry'@'localhost' IDENTIFIED BY 'EPPRegistry';
CREATE USER 'registry-select'@'localhost' IDENTIFIED BY 'EPPRegistrySELECT';
CREATE USER 'registry-update'@'localhost' IDENTIFIED BY 'EPPRegistryUPDATE';
GRANT ALL ON `registry`.* TO 'registry'@'localhost';
GRANT SELECT ON `registry`.* TO 'registry-select'@'localhost';
GRANT UPDATE ON `registry`.`payment_history` TO 'registry-update'@'localhost';
CREATE DATABASE IF NOT EXISTS `registryTransaction`;
CREATE TABLE IF NOT EXISTS `registryTransaction`.`transaction_identifier` (

View file

@ -80,6 +80,7 @@ CREATE TABLE registry.registrar (
"creditthreshold" decimal(12,2) NOT NULL default '0.00',
"thresholdtype" varchar CHECK ("thresholdtype" IN ( 'fixed','percent' )) NOT NULL default 'fixed',
"currency" varchar(5) NOT NULL default 'USD',
"vat_number" VARCHAR(30) DEFAULT NULL,
"crdate" timestamp(3) without time zone NOT NULL,
"lastupdate" timestamp(3),
primary key ("id"),
@ -570,18 +571,32 @@ CREATE TABLE registry.icann_reports (
);
CREATE TABLE registry.promotion_pricing (
"id" serial8 PRIMARY KEY,
"id" SERIAL PRIMARY KEY,
"tld_id" INT CHECK ("tld_id" >= 0),
"promo_name" VARCHAR(255) NOT NULL,
"start_date" DATE NOT NULL,
"end_date" DATE NOT NULL,
"discount_percentage" DECIMAL(5,2),
"discount_amount" DECIMAL(10,2),
"description" TEXT,
"conditions" TEXT,
"promo_name" varchar(255) NOT NULL,
"start_date" timestamp(3) NOT NULL,
"end_date" timestamp(3) NOT NULL,
"discount_percentage" numeric(5,2),
"discount_amount" numeric(10,2),
"description" text,
"conditions" text,
"promo_type" VARCHAR CHECK (promo_type IN ('full', 'registration', 'renewal', 'transfer')) NOT NULL,
"years_of_promotion" integer,
"max_count" integer,
"registrar_ids" jsonb,
"status" VARCHAR CHECK (status IN ('active', 'expired', 'upcoming')) NOT NULL,
"minimum_purchase" numeric(10,2),
"target_segment" varchar(255),
"region_specific" varchar(255),
"created_by" varchar(255),
"created_at" timestamp(3) without time zone,
"updated_by" varchar(255),
"updated_at" timestamp(3) without time zone,
FOREIGN KEY ("tld_id") REFERENCES registry.domain_tld("id")
);
CREATE INDEX idx_promotion_pricing_tld_id ON promotion_pricing (tld_id);
CREATE TABLE registry.premium_domain_categories (
"category_id" serial8 PRIMARY KEY,
"category_name" VARCHAR(255) NOT NULL,