salix/db/versions/10988-blackIvy/00-pbx_prefix.sql

36 lines
1.1 KiB
SQL

CREATE TABLE IF NOT EXISTS pbx.prefix (
country CHAR(2) NOT NULL COMMENT 'Country code',
prefix varchar(100) NOT NULL COMMENT 'Country prefix',
CONSTRAINT prefix_pk PRIMARY KEY (country)
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci;
ALTER TABLE pbx.config
CHANGE countryPrefix defaultPrefix varchar(20)
CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;
ALTER TABLE pbx.config DROP COLUMN IF EXISTS sundayFestive;
CREATE TABLE IF NOT EXISTS pbx.holiday (
id INT UNSIGNED auto_increment NOT NULL,
country CHAR(2) NOT NULL,
`day` DATE NOT NULL,
CONSTRAINT holiday_pk PRIMARY KEY (id)
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci;
CREATE UNIQUE INDEX holiday_country_IDX USING BTREE ON pbx.holiday (country,`day`);
ALTER TABLE pbx.schedule
CHANGE timeStart startTime time NOT NULL,
CHANGE timeEnd endTime time NOT NULL,
DROP FOREIGN KEY schedule_ibfk_1,
DROP COLUMN queue,
ADD country CHAR(2) NOT NULL,
CHANGE weekDay weekDays set('mon','tue','wed','thu','fri','sat','sun') NOT NULL
COMMENT '0 = Monday, 6 = Sunday';