mirror of https://github.com/sipwise/db-schema.git
parent
373ea60ac8
commit
376764379b
@ -1,38 +0,0 @@
|
||||
USE mysql;
|
||||
DROP DATABASE IF EXISTS sipstats;
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS sipstats CHARACTER SET 'utf8';
|
||||
|
||||
USE sipstats;
|
||||
|
||||
-- create packets tables
|
||||
|
||||
CREATE TABLE `packets` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`timestamp` decimal(17,6) NOT NULL,
|
||||
`src_mac` binary(6) NOT NULL,
|
||||
`dst_mac` binary(6) NOT NULL,
|
||||
`protocol` enum('IPv4','IPv6') NOT NULL,
|
||||
`src_ip` varchar(39) NOT NULL,
|
||||
`dst_ip` varchar(39) NOT NULL,
|
||||
`src_port` smallint(5) unsigned NOT NULL,
|
||||
`dst_port` smallint(5) unsigned NOT NULL,
|
||||
`header` blob NOT NULL,
|
||||
`payload` blob NOT NULL,
|
||||
`trailer` blob NOT NULL,
|
||||
`method` varchar(20) NOT NULL,
|
||||
`cseq_method` varchar(16) NOT NULL,
|
||||
`call_id` varchar(255) NOT NULL,
|
||||
`request_uri` varchar(255) NOT NULL,
|
||||
`from_uri` varchar(255) NOT NULL,
|
||||
`caller_uuid` varchar(255) NOT NULL,
|
||||
`callee_uuid` varchar(255) NOT NULL,
|
||||
`was_fragmented` tinyint(3) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`,`timestamp`),
|
||||
KEY `call_id_idx` (`call_id`),
|
||||
KEY `caller_uuid_idx` (`caller_uuid`),
|
||||
KEY `callee_uuid_idx` (`callee_uuid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
PARTITION BY RANGE (FLOOR(`timestamp`))
|
||||
(PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM);
|
||||
|
@ -1,104 +0,0 @@
|
||||
-- step out of our billing DB
|
||||
USE mysql;
|
||||
|
||||
-- drop database if it allready exists
|
||||
-- this will drop all tables and triggers
|
||||
DROP DATABASE IF EXISTS carrier;
|
||||
|
||||
-- create DB with utf8 default charset, so we don't have to
|
||||
-- specify charset for each table
|
||||
CREATE DATABASE carrier CHARACTER SET 'utf8';
|
||||
|
||||
USE carrier;
|
||||
|
||||
CREATE TABLE `customers` (
|
||||
`id` int(11) UNSIGNED NOT NULL auto_increment,
|
||||
`external_id` varchar(255) NULL default NULL,
|
||||
`url` varchar(31) NOT NULL,
|
||||
`shopuser` varchar(31) NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `externalid_idx` (`external_id`),
|
||||
UNIQUE KEY `shopuser_idx` (`shopuser`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `orders` (
|
||||
`id` int(11) UNSIGNED NOT NULL auto_increment,
|
||||
`customer_id` int(11) UNSIGNED NOT NULL REFERENCES `customers` (`id`),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `customerid_idx` (`customer_id`),
|
||||
CONSTRAINT `o_customerid_ref` FOREIGN KEY (`customer_id`)
|
||||
REFERENCES `customers` (`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `contracts` (
|
||||
`id` int(11) UNSIGNED NOT NULL auto_increment,
|
||||
`external_id` varchar(255) NULL default NULL,
|
||||
`url` varchar(31) NULL default NULL,
|
||||
`customer_id` int(11) UNSIGNED NULL REFERENCES `customers` (`id`),
|
||||
`sip_uri` varchar(127) NULL default NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `externalid_idx` (`external_id`),
|
||||
KEY `customerid_idx` (`customer_id`),
|
||||
CONSTRAINT `c_customerid_ref` FOREIGN KEY (`customer_id`)
|
||||
REFERENCES `customers` (`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `credits` (
|
||||
`id` int(11) UNSIGNED NOT NULL auto_increment,
|
||||
`contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `contractid_idx` (`contract_id`),
|
||||
CONSTRAINT `c_contractid_ref` FOREIGN KEY (`contract_id`)
|
||||
REFERENCES `contracts` (`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `payments` (
|
||||
`id` int(11) UNSIGNED NOT NULL auto_increment,
|
||||
`order_id` int(11) UNSIGNED NULL REFERENCES `orders` (`id`),
|
||||
`credit_id` int(11) UNSIGNED NULL REFERENCES `credits` (`id`),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `orderid_idx` (`order_id`),
|
||||
CONSTRAINT `p_orderid_ref` FOREIGN KEY (`order_id`)
|
||||
REFERENCES `orders` (`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
KEY `creditid_idx` (`credit_id`),
|
||||
CONSTRAINT `p_creditid_ref` FOREIGN KEY (`credit_id`)
|
||||
REFERENCES `credits` (`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `subscribers` (
|
||||
`id` int(11) UNSIGNED NOT NULL auto_increment,
|
||||
`external_id` varchar(255) NULL default NULL,
|
||||
`username` varchar(127) NOT NULL,
|
||||
`domain` varchar(127) NOT NULL,
|
||||
`webusername` varchar(127) default NULL,
|
||||
`contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `externalid_idx` (`external_id`),
|
||||
UNIQUE KEY `usrdom_idx` (`username`, `domain`),
|
||||
UNIQUE KEY `domwebuser_idx` (`domain`, `webusername`),
|
||||
KEY `contractid_idx` (`contract_id`),
|
||||
CONSTRAINT `s_contractid_ref` FOREIGN KEY (`contract_id`)
|
||||
REFERENCES `contracts` (`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `numbers` (
|
||||
`number` varchar(42) NOT NULL,
|
||||
`subscriber_id` int(11) UNSIGNED NULL REFERENCES `subscribers` (`id`),
|
||||
PRIMARY KEY `number_idx` (`number`),
|
||||
KEY `subscriberid_idx` (`subscriber_id`),
|
||||
CONSTRAINT `n_subscriberid_ref` FOREIGN KEY (`subscriber_id`)
|
||||
REFERENCES `subscribers` (`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `interceptions` (
|
||||
`id` int(11) UNSIGNED NOT NULL auto_increment,
|
||||
`url` varchar(31) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
@ -1,53 +1,59 @@
|
||||
GRANT SELECT ON mysql.* TO 'nagios'@'localhost' IDENTIFIED BY 'PW_CHECKTOOL';
|
||||
GRANT SELECT ON kamailio.location TO 'nagios'@'localhost' IDENTIFIED BY 'PW_CHECKTOOL';
|
||||
GRANT SELECT ON provisioning.voip_subscribers TO 'nagios'@'localhost' IDENTIFIED BY 'PW_CHECKTOOL';
|
||||
GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO replicator@"192.168.255.%" IDENTIFIED BY 'PW_REPLICATOR';
|
||||
|
||||
GRANT SELECT ON kamailio.* TO 'kamailioro'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW';
|
||||
GRANT ALL ON kamailio.* TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW';
|
||||
GRANT SELECT ON kamailio.location TO 'natping'@'localhost' IDENTIFIED BY 'PW_NATPING';
|
||||
GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO nagios@"192.168.255.%" IDENTIFIED BY 'PW_CHECKTOOL';
|
||||
GRANT SELECT ON mysql.* TO nagios@"192.168.255.%" IDENTIFIED BY 'PW_CHECKTOOL';
|
||||
GRANT SELECT ON mysql.* TO nagios@localhost IDENTIFIED BY 'PW_CHECKTOOL';
|
||||
GRANT SELECT ON kamailio.location TO nagios@"192.168.255.%" IDENTIFIED BY 'PW_CHECKTOOL';
|
||||
GRANT SELECT ON kamailio.location TO nagios@localhost IDENTIFIED BY 'PW_CHECKTOOL';
|
||||
|
||||
#GRANT ALL ON accounting.* TO 'collector'@'localhost' IDENTIFIED BY 'PW_COLLECTOR';
|
||||
GRANT SELECT ON kamailio.* TO kamailioro@localhost IDENTIFIED BY 'PW_KAMAILIORW';
|
||||
GRANT ALL ON kamailio.* TO kamailio@localhost IDENTIFIED BY 'PW_KAMAILIORW';
|
||||
GRANT SELECT ON kamailio.location TO natping@'192.168.255.%' IDENTIFIED BY 'PW_NATPING';
|
||||
GRANT SELECT ON kamailio.location TO natping@localhost IDENTIFIED BY 'PW_NATPING';
|
||||
|
||||
GRANT ALL ON accounting.* TO 'collector'@'localhost' IDENTIFIED BY 'PW_COLLECTOR';
|
||||
GRANT ALL ON accounting.* TO 'collector'@'192.168.255.%' IDENTIFIED BY 'PW_COLLECTOR';
|
||||
|
||||
GRANT ALL ON accounting.* TO 'mediator'@'localhost' IDENTIFIED BY 'PW_MEDIATOR';
|
||||
GRANT ALL ON accounting.* TO 'mediator'@'192.168.255.%' IDENTIFIED BY 'PW_MEDIATOR';
|
||||
GRANT SELECT ON provisioning.* TO 'mediator'@'localhost' IDENTIFIED BY 'PW_MEDIATOR';
|
||||
GRANT SELECT ON provisioning.* TO 'mediator'@'192.168.255.%' IDENTIFIED BY 'PW_MEDIATOR';
|
||||
GRANT SELECT ON billing.* TO 'mediator'@'localhost' IDENTIFIED BY 'PW_MEDIATOR';
|
||||
GRANT SELECT ON billing.* TO 'mediator'@'192.168.255.%' IDENTIFIED BY 'PW_MEDIATOR';
|
||||
|
||||
GRANT ALL ON accounting.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP';
|
||||
GRANT ALL ON accounting.* TO 'soap'@'192.168.255.%' IDENTIFIED BY 'PW_SOAP';
|
||||
GRANT ALL ON billing.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP';
|
||||
GRANT ALL ON billing.* TO 'soap'@'192.168.255.%' IDENTIFIED BY 'PW_SOAP';
|
||||
|
||||
GRANT ALL PRIVILEGES ON kamailio.voicemail_users TO 'asterisk'@'localhost' IDENTIFIED BY 'PW_ASTERISK';
|
||||
GRANT ALL PRIVILEGES ON kamailio.voicemail_spool TO 'asterisk'@'localhost' IDENTIFIED BY 'PW_ASTERISK';
|
||||
GRANT ALL PRIVILEGES ON kamailio.voicemail_users TO asterisk@'192.168.255.%' IDENTIFIED BY 'PW_ASTERISK';
|
||||
GRANT ALL PRIVILEGES ON kamailio.voicemail_users TO asterisk@localhost IDENTIFIED BY 'PW_ASTERISK';
|
||||
GRANT ALL PRIVILEGES ON kamailio.voicemail_spool TO asterisk@'192.168.255.%' IDENTIFIED BY 'PW_ASTERISK';
|
||||
GRANT ALL PRIVILEGES ON kamailio.voicemail_spool TO asterisk@localhost IDENTIFIED BY 'PW_ASTERISK';
|
||||
|
||||
GRANT ALL ON provisioning.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP';
|
||||
GRANT ALL ON provisioning.* TO 'soap'@'192.168.255.%' IDENTIFIED BY 'PW_SOAP';
|
||||
GRANT ALL ON kamailio.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP';
|
||||
GRANT ALL ON sipstats.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP';
|
||||
|
||||
|
||||
GRANT SELECT ON accounting.cdr TO 'exporter'@'localhost' IDENTIFIED BY 'PW_EXPORTER';
|
||||
GRANT SELECT,INSERT,UPDATE ON accounting.mark TO 'exporter'@'localhost' IDENTIFIED BY 'PW_EXPORTER';
|
||||
GRANT SELECT ON billing.billing_zones_history TO 'exporter'@'localhost' IDENTIFIED BY 'PW_EXPORTER';
|
||||
|
||||
GRANT RELOAD ON *.* TO 'rsyslog'@'localhost' IDENTIFIED BY 'PW_RSYSLOG';
|
||||
GRANT ALL on syslog.* TO 'rsyslog'@'localhost' IDENTIFIED BY 'PW_RSYSLOG';
|
||||
|
||||
GRANT SELECT,INSERT,UPDATE ON accounting.* TO 'rateomat'@'localhost' IDENTIFIED BY 'PW_RATEOMAT';
|
||||
GRANT DELETE ON accounting.prepaid_costs TO 'rateomat'@'localhost' IDENTIFIED BY 'PW_RATEOMAT';
|
||||
GRANT SELECT,INSERT,UPDATE ON billing.* TO 'rateomat'@'localhost' IDENTIFIED BY 'PW_RATEOMAT';
|
||||
GRANT ALL ON kamailio.* TO 'soap'@'192.168.255.%' IDENTIFIED BY 'PW_SOAP';
|
||||
|
||||
GRANT SELECT,INSERT,UPDATE ON accounting.* TO 'sems_prepaid'@'localhost' IDENTIFIED BY 'PW_SEMS_PREPAID';
|
||||
GRANT SELECT,INSERT,UPDATE ON billing.* TO 'sems_prepaid'@'localhost' IDENTIFIED BY 'PW_SEMS_PREPAID';
|
||||
GRANT SELECT ON powerdns.* TO pdns@'192.168.255.%' IDENTIFIED BY 'dns4Sipwise!';
|
||||
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'sipwise'@'localhost' IDENTIFIED BY 'PW_SIPWISE' WITH GRANT OPTION;
|
||||
GRANT SELECT ON accounting.cdr TO exporter@'192.168.255.%' IDENTIFIED BY 'PW_EXPORTER';
|
||||
GRANT SELECT ON accounting.cdr TO exporter@localhost IDENTIFIED BY 'PW_EXPORTER';
|
||||
GRANT SELECT,INSERT,UPDATE ON accounting.mark TO exporter@'192.168.255.%' IDENTIFIED BY 'PW_EXPORTER';
|
||||
GRANT SELECT,INSERT,UPDATE ON accounting.mark TO exporter@localhost IDENTIFIED BY 'PW_EXPORTER';
|
||||
|
||||
GRANT ALL PRIVILEGES ON kamailio.* to 'dbcleaner'@'localhost' IDENTIFIED BY 'PW_CLEANUP_TOOLS';
|
||||
GRANT ALL PRIVILEGES ON accounting.* to 'dbcleaner'@'localhost' IDENTIFIED BY 'PW_CLEANUP_TOOLS';
|
||||
GRANT RELOAD ON *.* TO rsyslog@localhost IDENTIFIED BY 'PW_RSYSLOG';
|
||||
GRANT ALL on syslog.* TO rsyslog@localhost IDENTIFIED BY 'PW_RSYSLOG';
|
||||
|
||||
GRANT SELECT ON provisioning.* to 'hylafax'@'localhost' IDENTIFIED BY 'PW_HYLAFAX';
|
||||
GRANT SELECT,INSERT,UPDATE ON accounting.* TO rateomat@'192.168.255.%' IDENTIFIED BY 'PW_RATEOMAT';
|
||||
GRANT SELECT,INSERT,UPDATE ON accounting.* TO rateomat@localhost IDENTIFIED BY 'PW_RATEOMAT';
|
||||
GRANT SELECT,INSERT,UPDATE ON billing.* TO rateomat@'192.168.255.%' IDENTIFIED BY 'PW_RATEOMAT';
|
||||
GRANT SELECT,INSERT,UPDATE ON billing.* TO rateomat@localhost IDENTIFIED BY 'PW_RATEOMAT';
|
||||
|
||||
GRANT ALL ON sipstats.* to 'voisniff'@'localhost' IDENTIFIED BY 'PW_VOISNIFF';
|
||||
GRANT ALL PRIVILEGES ON *.* TO sipwise@localhost IDENTIFIED BY 'PW_SIPWISE' WITH GRANT OPTION;
|
||||
|
||||
GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO 'replicator'@'sp1' IDENTIFIED BY 'PW_REPLICATOR';
|
||||
GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO 'replicator'@'sp2' IDENTIFIED BY 'PW_REPLICATOR';
|
||||
GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO 'nagios'@'sp1' IDENTIFIED BY 'PW_CHECKTOOL';
|
||||
GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO 'nagios'@'sp2' IDENTIFIED BY 'PW_CHECKTOOL';
|
||||
GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO 'nagios'@'localhost' IDENTIFIED BY 'PW_CHECKTOOL';
|
||||
GRANT ALL PRIVILEGES ON kamailio.* to dbcleaner@localhost IDENTIFIED BY 'PW_CLEANUP_TOOLS';
|
||||
GRANT ALL PRIVILEGES ON kamailio.* to dbcleaner@'192.168.255.%' IDENTIFIED BY 'PW_CLEANUP_TOOLS';
|
||||
GRANT ALL PRIVILEGES ON accounting.* to dbcleaner@localhost IDENTIFIED BY 'PW_CLEANUP_TOOLS';
|
||||
GRANT ALL PRIVILEGES ON accounting.* to dbcleaner@'192.168.255.%' IDENTIFIED BY 'PW_CLEANUP_TOOLS';
|
||||
|
@ -1,2 +0,0 @@
|
||||
ALTER TABLE provisioning.voip_preferences MODIFY COLUMN `type` tinyint(3) NOT NULL;
|
||||
ALTER TABLE provisioning.voip_preferences DROP COLUMN `data_type`;
|
@ -1,18 +0,0 @@
|
||||
ALTER TABLE provisioning.voip_preferences MODIFY COLUMN `type` tinyint(3) NOT NULL default 0;
|
||||
ALTER TABLE provisioning.voip_preferences ADD COLUMN `data_type` enum('bool','int','string') NOT NULL default 'string';
|
||||
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'block_in_mode';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'block_in_clir';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'block_out_mode';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'adm_block_in_mode';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'adm_block_in_clir';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'adm_block_out_mode';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'clir';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'lock';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'ringtimeout';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'ncos_id';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'adm_ncos_id';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'dp_dom_caller_in';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'dp_dom_callee_in';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'dp_dom_caller_out';
|
||||
UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'dp_dom_callee_out';
|
Loading…
Reference in new issue