| 1 | -- Alter table to allow use of ipv6, cname and txt in dns record |
|---|
| 2 | ALTER TABLE sub_domaines DROP PRIMARY KEY; |
|---|
| 3 | ALTER TABLE sub_domaines ADD CONSTRAINT pk_SubDomaines PRIMARY KEY (compte,domaine,sub,type,valeur); |
|---|
| 4 | |
|---|
| 5 | -- Alter table mail_domain to add support of temporary mail |
|---|
| 6 | ALTER TABLE mail_domain ADD expiration_date datetime DEFAULT null; |
|---|
| 7 | |
|---|
| 8 | -- Domains type |
|---|
| 9 | CREATE TABLE IF NOT EXISTS `domaines_type` ( |
|---|
| 10 | `name` VARCHAR (255) NOT NULL, -- Uniq name |
|---|
| 11 | `description` TEXT, -- Human description |
|---|
| 12 | `target` enum ('NONE', 'URL', 'DIRECTORY', 'IP', 'IPV6', 'DOMAIN', 'TXT') NOT NULL DEFAULT 'NONE', -- Target type |
|---|
| 13 | `entry` VARCHAR (255) DEFAULT '', -- BIND entry |
|---|
| 14 | `compatibility` VARCHAR (255) DEFAULT '', -- Which type can be on the same subdomains |
|---|
| 15 | `enable` enum ('ALL', 'NONE', 'ADMIN') NOT NULL DEFAULT 'ALL', -- Show this option to who ? |
|---|
| 16 | `only_dns` BOOLEAN DEFAULT FALSE, -- Update_domains modify just the dns, no web configuration |
|---|
| 17 | `need_dns` BOOLEAN DEFAULT TRUE, -- The server need to be the DNS to allow this service |
|---|
| 18 | `advanced` BOOLEAN DEFAULT TRUE, -- It's an advanced option |
|---|
| 19 | PRIMARY KEY ( `name` ) |
|---|
| 20 | ) COMMENT = 'Type of domains allowed'; |
|---|
| 21 | |
|---|
| 22 | INSERT IGNORE INTO `domaines_type` (name, description, target, entry, compatibility, only_dns, need_dns, advanced) values |
|---|
| 23 | ('vhost','Locally hosted', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false, false), |
|---|
| 24 | ('url','URL redirection', 'URL', '%SUB% IN A @@PUBLIC_IP@@','txt', true, true, false), |
|---|
| 25 | ('ip','IPv4 redirect', 'IP', '%SUB% IN A %TARGET%','url,ip,ipv6,txt', false, true, false), |
|---|
| 26 | ('webmail', 'Webmail access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false, false), |
|---|
| 27 | ('ipv6','IPv6 redirect', 'IPV6', '%SUB% IN AAAA %TARGET%','ip,ipv6,webmail,txt',true, true, true ), |
|---|
| 28 | ('cname', 'CNAME DNS entry', 'DOMAIN', '%SUB% CNAME %TARGET%', 'txt',true, true, true ), |
|---|
| 29 | ('txt', 'TXT DNS entry', 'TXT', '%SUB% IN TXT "%TARGET%"','vhost,url,ip,webmail,ipv6,cname,txt,mx',true, true, true), |
|---|
| 30 | ('mx', 'MX DNS entry', 'IP', '%SUB% IN MX 5 %TARGET%', 'vhost,url,ip,webmail,ipv6,cname,txt,mx',true, false, true), |
|---|
| 31 | ('panel', 'AlternC panel access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'vhost,url,ip,webmail,ipv6,cname,txt',true, false, true) |
|---|
| 32 | ; |
|---|
| 33 | |
|---|
| 34 | -- Changing standby use |
|---|
| 35 | alter table domaines add column dns_action enum ('OK','UPDATE','DELETE') NOT NULL default 'UPDATE'; |
|---|
| 36 | alter table domaines add column dns_result varchar(255) not null default ''; |
|---|
| 37 | alter table sub_domaines add column web_action enum ('OK','UPDATE','DELETE') NOT NULL default 'UPDATE'; |
|---|
| 38 | alter table sub_domaines add column web_result varchar(255) not null default ''; |
|---|
| 39 | alter table sub_domaines add column enable enum ('ENABLED', 'ENABLE', 'DISABLED', 'DISABLE') NOT NULL DEFAULT 'ENABLED'; |
|---|
| 40 | drop table sub_domaines_standby; |
|---|
| 41 | drop table domaines_standby; |
|---|
| 42 | |
|---|
| 43 | update sub_domaines set type='VHOST' where type='0'; -- We decide to drop massvhost. |
|---|
| 44 | update sub_domaines set type='URL' where type='1'; |
|---|
| 45 | update sub_domaines set type='IP' where type='2'; |
|---|
| 46 | update sub_domaines set type='WEBMAIL' where type='3'; |
|---|
| 47 | update sub_domaines set type='IPV6' where type='4'; |
|---|
| 48 | update sub_domaines set type='CNAME' where type='5'; |
|---|
| 49 | update sub_domaines set type='TXT' where type='6'; |
|---|
| 50 | update sub_domaines set web_action='UPDATE'; |
|---|
| 51 | |
|---|