MT#59286 convert accounting, stats database tables to use bigint

* all id AUTO INCREMENT fields in:
   - accounting.cdr* tables (except the dictionary tables)
   - acounting.acc* tables
   - accounting.events tables
   - cdr and events related reference fields
  that are of int(10)/int(11) are converted to bigint(20).
  that is to overcome the id auto increment overflow issue.
* SQL_MODE=STRICT_ALL_TABLES is used to prevent potential data loss
  if the value cannot be safely converted (mostly needed in the .down
  script).

Change-Id: I37ee0ea7160582ffae71fb4fc59df4148e95b02c
mr26.1
Kirill Solomko 3 months ago committed by Sipwise Jenkins Builder
parent 522e2470c9
commit 75882c9f17

@ -0,0 +1,97 @@
SET sql_log_bin=0;
SET sql_mode=STRICT_ALL_TABLES;
USE accounting;
ALTER TABLE accounting.acc
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.acc_backup
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.acc_cdi
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.acc_trash
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.cdr
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.cdr_cash_balance_data
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.cdr_export_status_data
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.cdr_group
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.cdr_mos_data
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.cdr_period_costs
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
MODIFY `first_cdr_id` int(10) unsigned DEFAULT NULL,
MODIFY `last_cdr_id` int(10) unsigned DEFAULT NULL;
ALTER TABLE accounting.cdr_relation_data
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.cdr_tag_data
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.cdr_time_balance_data
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.events
MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.events_relation_data
MODIFY `event_id` int(11) unsigned NOT NULL;
ALTER TABLE accounting.events_tag_data
MODIFY `event_id` int(11) unsigned NOT NULL;
ALTER TABLE accounting.int_cdr
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.int_cdr_cash_balance_data
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.int_cdr_export_status_data
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.int_cdr_group
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.int_cdr_relation_data
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.int_cdr_tag_data
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.int_cdr_time_balance_data
MODIFY `cdr_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.malicious_calls
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.mark
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
MODIFY `acc_id` int(10) unsigned NOT NULL;
ALTER TABLE accounting.prepaid_costs
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
USE stats;
ALTER TABLE stats.call_info
MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE stats.cdr_info
MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
MODIFY `last_rated_id` int(11) unsigned DEFAULT NULL;

@ -0,0 +1,96 @@
SET sql_log_bin=0;
SET sql_mode=STRICT_ALL_TABLES;
USE accounting;
ALTER TABLE accounting.acc
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.acc_backup
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.acc_cdi
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.acc_trash
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.cdr
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.cdr_cash_balance_data
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.cdr_export_status_data
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.cdr_group
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.cdr_mos_data
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.cdr_period_costs
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
MODIFY `first_cdr_id` bigint(20) unsigned DEFAULT NULL,
MODIFY `last_cdr_id` bigint(20) unsigned DEFAULT NULL;
ALTER TABLE accounting.cdr_relation_data
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.cdr_tag_data
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.cdr_time_balance_data
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.events
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.events_relation_data
MODIFY `event_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.events_tag_data
MODIFY `event_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.int_cdr
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.int_cdr_cash_balance_data
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.int_cdr_export_status_data
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.int_cdr_group
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.int_cdr_relation_data
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.int_cdr_tag_data
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.int_cdr_time_balance_data
MODIFY `cdr_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.malicious_calls
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE accounting.mark
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
MODIFY `acc_id` bigint(20) unsigned NOT NULL;
ALTER TABLE accounting.prepaid_costs
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT;
USE stats;
ALTER TABLE stats.call_info
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE stats.cdr_info
MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
MODIFY `last_rated_id` bigint(20) unsigned DEFAULT NULL;

@ -77,7 +77,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -269,7 +269,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -401,7 +401,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -497,7 +497,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -1157,7 +1157,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -1733,7 +1733,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -1853,7 +1853,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -1925,7 +1925,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -1949,7 +1949,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -2069,7 +2069,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : "NULL",
"COLUMN_NAME" : "first_cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "YES",
"ORDINAL_POSITION" : 14,
@ -2117,7 +2117,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -2129,7 +2129,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : "NULL",
"COLUMN_NAME" : "last_cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "YES",
"ORDINAL_POSITION" : 16,
@ -2309,7 +2309,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -2405,7 +2405,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -2501,7 +2501,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -2609,7 +2609,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(11) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -2717,7 +2717,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "event_id",
"COLUMN_TYPE" : "int(11) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -2789,7 +2789,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "event_id",
"COLUMN_TYPE" : "int(11) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -3389,7 +3389,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -3941,7 +3941,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -4013,7 +4013,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -4085,7 +4085,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -4109,7 +4109,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -4181,7 +4181,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -4253,7 +4253,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "cdr_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -4397,7 +4397,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -4445,7 +4445,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "acc_id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 3,
@ -4469,7 +4469,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -4529,7 +4529,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(10) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,

@ -9,7 +9,7 @@ USE accounting;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `acc` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`method` varchar(16) NOT NULL DEFAULT '',
`from_tag` varchar(64) NOT NULL DEFAULT '',
`to_tag` varchar(64) NOT NULL DEFAULT '',
@ -32,7 +32,7 @@ CREATE TABLE `acc` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `acc_backup` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`method` varchar(16) NOT NULL DEFAULT '',
`from_tag` varchar(64) NOT NULL DEFAULT '',
`to_tag` varchar(64) NOT NULL DEFAULT '',
@ -55,7 +55,7 @@ CREATE TABLE `acc_backup` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `acc_cdi` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`callid` varchar(255) NOT NULL,
`mark` decimal(13,3) NOT NULL,
PRIMARY KEY (`id`),
@ -65,7 +65,7 @@ CREATE TABLE `acc_cdi` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `acc_trash` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`method` varchar(16) NOT NULL DEFAULT '',
`from_tag` varchar(64) NOT NULL DEFAULT '',
`to_tag` varchar(64) NOT NULL DEFAULT '',
@ -88,7 +88,7 @@ CREATE TABLE `acc_trash` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cdr` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`update_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`source_user_id` char(36) NOT NULL,
`source_provider_id` varchar(255) NOT NULL,
@ -207,7 +207,7 @@ CREATE TABLE `cdr_cash_balance` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cdr_cash_balance_data` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`provider_id` int(3) unsigned NOT NULL,
`direction_id` int(3) unsigned NOT NULL,
`cash_balance_id` int(3) unsigned NOT NULL,
@ -239,7 +239,7 @@ CREATE TABLE `cdr_export_status` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cdr_export_status_data` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`status_id` int(3) unsigned NOT NULL,
`exported_at` datetime DEFAULT NULL,
`export_status` enum('unexported','ok','failed','skipped') NOT NULL DEFAULT 'unexported',
@ -251,7 +251,7 @@ CREATE TABLE `cdr_export_status_data` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cdr_group` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`call_id` varchar(255) NOT NULL,
`cdr_start_time` decimal(13,3) NOT NULL,
PRIMARY KEY (`cdr_id`,`call_id`,`cdr_start_time`),
@ -262,7 +262,7 @@ CREATE TABLE `cdr_group` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cdr_mos_data` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`mos_average` decimal(5,1) DEFAULT NULL,
`mos_average_packetloss` decimal(5,1) DEFAULT NULL,
`mos_average_jitter` decimal(5,1) DEFAULT NULL,
@ -274,7 +274,7 @@ CREATE TABLE `cdr_mos_data` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cdr_period_costs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`contract_id` int(11) unsigned NOT NULL,
`period` enum('month','day') NOT NULL,
`period_date` date NOT NULL,
@ -287,9 +287,9 @@ CREATE TABLE `cdr_period_costs` (
`notify_status` enum('new','notified') NOT NULL DEFAULT 'new',
`notified_at` datetime DEFAULT NULL,
`first_cdr_start_time` decimal(13,3) NOT NULL,
`first_cdr_id` int(10) unsigned DEFAULT NULL,
`first_cdr_id` bigint(20) unsigned DEFAULT NULL,
`last_cdr_start_time` decimal(13,3) NOT NULL,
`last_cdr_id` int(10) unsigned DEFAULT NULL,
`last_cdr_id` bigint(20) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `contract_id` (`contract_id`,`period`,`period_date`,`direction`),
KEY `cdrperiodcosts_pdfls` (`period`,`period_date`,`direction`,`fraud_limit_exceeded`,`notify_status`),
@ -330,7 +330,7 @@ CREATE TABLE `cdr_relation` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cdr_relation_data` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`provider_id` int(3) unsigned NOT NULL,
`direction_id` int(3) unsigned NOT NULL,
`relation_id` int(3) unsigned NOT NULL,
@ -352,7 +352,7 @@ CREATE TABLE `cdr_tag` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cdr_tag_data` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`provider_id` int(3) unsigned NOT NULL,
`direction_id` int(3) unsigned NOT NULL,
`tag_id` int(3) unsigned NOT NULL,
@ -374,7 +374,7 @@ CREATE TABLE `cdr_time_balance` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cdr_time_balance_data` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`provider_id` int(3) unsigned NOT NULL,
`direction_id` int(3) unsigned NOT NULL,
`time_balance_id` int(3) unsigned NOT NULL,
@ -388,7 +388,7 @@ CREATE TABLE `cdr_time_balance_data` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `events` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(255) NOT NULL,
`subscriber_id` int(11) unsigned NOT NULL,
`reseller_id` int(11) unsigned NOT NULL DEFAULT 1,
@ -415,7 +415,7 @@ CREATE TABLE `events_relation` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `events_relation_data` (
`event_id` int(11) unsigned NOT NULL,
`event_id` bigint(20) unsigned NOT NULL,
`relation_id` int(3) unsigned NOT NULL,
`val` int(10) unsigned NOT NULL,
`event_timestamp` decimal(13,3) NOT NULL,
@ -435,7 +435,7 @@ CREATE TABLE `events_tag` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `events_tag_data` (
`event_id` int(11) unsigned NOT NULL,
`event_id` bigint(20) unsigned NOT NULL,
`tag_id` int(3) unsigned NOT NULL,
`val` text NOT NULL,
`event_timestamp` decimal(13,3) NOT NULL,
@ -446,7 +446,7 @@ CREATE TABLE `events_tag_data` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `int_cdr` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`update_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`source_user_id` char(36) NOT NULL,
`source_provider_id` varchar(255) NOT NULL,
@ -558,7 +558,7 @@ CREATE TABLE `int_cdr` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `int_cdr_cash_balance_data` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`provider_id` int(3) unsigned NOT NULL,
`direction_id` int(3) unsigned NOT NULL,
`cash_balance_id` int(3) unsigned NOT NULL,
@ -572,7 +572,7 @@ CREATE TABLE `int_cdr_cash_balance_data` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `int_cdr_export_status_data` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`status_id` int(3) unsigned NOT NULL,
`exported_at` datetime DEFAULT NULL,
`export_status` enum('unexported','ok','failed','skipped') NOT NULL DEFAULT 'unexported',
@ -584,7 +584,7 @@ CREATE TABLE `int_cdr_export_status_data` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `int_cdr_group` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`call_id` varchar(255) NOT NULL,
`cdr_start_time` decimal(13,3) NOT NULL,
PRIMARY KEY (`cdr_id`,`call_id`,`cdr_start_time`),
@ -595,7 +595,7 @@ CREATE TABLE `int_cdr_group` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `int_cdr_relation_data` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`provider_id` int(3) unsigned NOT NULL,
`direction_id` int(3) unsigned NOT NULL,
`relation_id` int(3) unsigned NOT NULL,
@ -608,7 +608,7 @@ CREATE TABLE `int_cdr_relation_data` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `int_cdr_tag_data` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`provider_id` int(3) unsigned NOT NULL,
`direction_id` int(3) unsigned NOT NULL,
`tag_id` int(3) unsigned NOT NULL,
@ -621,7 +621,7 @@ CREATE TABLE `int_cdr_tag_data` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `int_cdr_time_balance_data` (
`cdr_id` int(10) unsigned NOT NULL,
`cdr_id` bigint(20) unsigned NOT NULL,
`provider_id` int(3) unsigned NOT NULL,
`direction_id` int(3) unsigned NOT NULL,
`time_balance_id` int(3) unsigned NOT NULL,
@ -635,7 +635,7 @@ CREATE TABLE `int_cdr_time_balance_data` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `malicious_calls` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`callee_uuid` varchar(255) NOT NULL,
`call_id` varchar(255) NOT NULL,
`start_time` decimal(13,3) NOT NULL,
@ -652,9 +652,9 @@ CREATE TABLE `malicious_calls` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `mark` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`collector` varchar(255) NOT NULL,
`acc_id` int(10) unsigned NOT NULL,
`acc_id` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `collector_idx` (`collector`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
@ -662,7 +662,7 @@ CREATE TABLE `mark` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `prepaid_costs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`call_id` varchar(255) NOT NULL,
`cost` double NOT NULL,
`free_time_used` int(10) unsigned NOT NULL,

@ -25,7 +25,7 @@ CREATE TABLE `db_schema` (
PRIMARY KEY (`id`),
UNIQUE KEY `rev_idx` (`revision`,`node`,`site_id`),
KEY `release_idx` (`release`)
) ENGINE=InnoDB AUTO_INCREMENT=925 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
) ENGINE=InnoDB AUTO_INCREMENT=926 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
@ -30977,6 +30977,7 @@ INSERT INTO `db_schema` VALUES (921,15876,'spce','1970-01-01 00:00:01','trunk',1
INSERT INTO `db_schema` VALUES (922,15877,'spce','1970-01-01 00:00:01','trunk',1);
INSERT INTO `db_schema` VALUES (923,15878,'spce','1970-01-01 00:00:01','trunk',1);
INSERT INTO `db_schema` VALUES (924,15879,'spce','1970-01-01 00:00:01','trunk',1);
INSERT INTO `db_schema` VALUES (925,15880,'spce','1970-01-01 00:00:01','trunk',1);
COMMIT;
SET AUTOCOMMIT=@OLD_AUTOCOMMIT;
SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0;

@ -17,7 +17,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(11) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -113,7 +113,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : null,
"COLUMN_NAME" : "id",
"COLUMN_TYPE" : "int(11) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "auto_increment",
"IS_NULLABLE" : "NO",
"ORDINAL_POSITION" : 1,
@ -125,7 +125,7 @@
"COLLATION_NAME" : null,
"COLUMN_DEFAULT" : "NULL",
"COLUMN_NAME" : "last_rated_id",
"COLUMN_TYPE" : "int(11) unsigned",
"COLUMN_TYPE" : "bigint(20) unsigned",
"EXTRA" : "",
"IS_NULLABLE" : "YES",
"ORDINAL_POSITION" : 18,

@ -9,7 +9,7 @@ USE stats;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `call_info` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`sip_code` varchar(3) NOT NULL,
`period` datetime NOT NULL,
`amount` int(11) unsigned NOT NULL,
@ -20,7 +20,7 @@ CREATE TABLE `call_info` (
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cdr_info` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`peer_in_total` int(11) unsigned NOT NULL DEFAULT 0,
`peer_in_rated` int(11) unsigned NOT NULL DEFAULT 0,
`peer_out_total` int(11) unsigned NOT NULL DEFAULT 0,
@ -37,7 +37,7 @@ CREATE TABLE `cdr_info` (
`customer_out_rated` int(11) unsigned NOT NULL DEFAULT 0,
`customer_cost` decimal(14,6) DEFAULT 0.000000,
`period` datetime NOT NULL,
`last_rated_id` int(11) unsigned DEFAULT NULL,
`last_rated_id` bigint(20) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `cdr_info_period_idx` (`period`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

Loading…
Cancel
Save