allow identical phone_numbers to exist from different carriers (#186)

This commit is contained in:
Dave Horton
2023-06-14 08:23:08 -04:00
committed by GitHub
parent 494f1cf784
commit 71ecf453f8
3 changed files with 38 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
/* SQLEditor (MySQL (2))*/
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS account_static_ips;
@@ -144,7 +145,7 @@ regex VARCHAR(32) NOT NULL COMMENT 'regex-based pattern match against dialed num
description VARCHAR(1024),
priority INTEGER NOT NULL COMMENT 'lower priority routes are attempted first',
PRIMARY KEY (lcr_route_sid)
) COMMENT='An ordered list of digit patterns in an LCR table. The patterns are tested in sequence until one matches';
) COMMENT='An ordered list of digit patterns in an LCR table. The pat';
CREATE TABLE lcr
(
@@ -155,7 +156,7 @@ default_carrier_set_entry_sid CHAR(36) COMMENT 'default carrier/route to use whe
service_provider_sid CHAR(36),
account_sid CHAR(36),
PRIMARY KEY (lcr_sid)
) COMMENT='An LCR (least cost routing) table that is used by a service provider or account to make decisions about routing outbound calls when multiple carriers are available.';
) COMMENT='An LCR (least cost routing) table that is used by a service ';
CREATE TABLE password_settings
(
@@ -411,7 +412,7 @@ PRIMARY KEY (smpp_gateway_sid)
CREATE TABLE phone_numbers
(
phone_number_sid CHAR(36) UNIQUE ,
number VARCHAR(132) NOT NULL UNIQUE ,
number VARCHAR(132) NOT NULL,
voip_carrier_sid CHAR(36),
account_sid CHAR(36),
application_sid CHAR(36),
@@ -632,6 +633,8 @@ CREATE INDEX smpp_gateway_sid_idx ON smpp_gateways (smpp_gateway_sid);
CREATE INDEX voip_carrier_sid_idx ON smpp_gateways (voip_carrier_sid);
ALTER TABLE smpp_gateways ADD FOREIGN KEY voip_carrier_sid_idxfk (voip_carrier_sid) REFERENCES voip_carriers (voip_carrier_sid);
CREATE UNIQUE INDEX phone_numbers_unique_idx_voip_carrier_number ON phone_numbers (number,voip_carrier_sid);
CREATE INDEX phone_number_sid_idx ON phone_numbers (phone_number_sid);
CREATE INDEX number_idx ON phone_numbers (number);
CREATE INDEX voip_carrier_sid_idx ON phone_numbers (voip_carrier_sid);
@@ -686,4 +689,5 @@ ALTER TABLE accounts ADD FOREIGN KEY queue_event_hook_sid_idxfk (queue_event_hoo
ALTER TABLE accounts ADD FOREIGN KEY device_calling_application_sid_idxfk (device_calling_application_sid) REFERENCES applications (application_sid);
ALTER TABLE accounts ADD FOREIGN KEY siprec_hook_sid_idxfk (siprec_hook_sid) REFERENCES applications (application_sid);
SET FOREIGN_KEY_CHECKS=1;
SET FOREIGN_KEY_CHECKS=1;

View File

@@ -2087,8 +2087,8 @@
<y>1128.00</y>
</location>
<size>
<width>265.00</width>
<height>140.00</height>
<width>522.00</width>
<height>160.00</height>
</size>
<zorder>2</zorder>
<SQLField>
@@ -2108,7 +2108,7 @@
<indexed><![CDATA[1]]></indexed>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[159B82ED-C6B0-4FC6-957B-5C354AF9E783]]></uid>
<unique><![CDATA[1]]></unique>
<unique><![CDATA[0]]></unique>
</SQLField>
<SQLField>
<name><![CDATA[voip_carrier_sid]]></name>
@@ -2170,6 +2170,24 @@
<objectComment><![CDATA[if not null, this number is a test number for the associated service provider]]></objectComment>
<uid><![CDATA[D2D46B75-F9C7-42A5-8D8C-4A8412C75ECA]]></uid>
</SQLField>
<SQLIndex>
<name><![CDATA[phone_numbers_unique_idx_voip_carrier_number]]></name>
<fieldName><![CDATA[number]]></fieldName>
<fieldName><![CDATA[voip_carrier_sid]]></fieldName>
<SQLIndexEntry>
<name><![CDATA[number]]></name>
<prefixSize><![CDATA[]]></prefixSize>
<fieldUid><![CDATA[159B82ED-C6B0-4FC6-957B-5C354AF9E783]]></fieldUid>
</SQLIndexEntry>
<SQLIndexEntry>
<name><![CDATA[voip_carrier_sid]]></name>
<prefixSize><![CDATA[]]></prefixSize>
<fieldUid><![CDATA[58A047B9-C1C9-4697-9FE8-08E3BFF91660]]></fieldUid>
</SQLIndexEntry>
<indexNamePrefix><![CDATA[phone_numbers]]></indexNamePrefix>
<indexType><![CDATA[UNIQUE]]></indexType>
<uid><![CDATA[4E84523A-7F30-4A5D-A0A8-578652102BD0]]></uid>
</SQLIndex>
<labelWindowIndex><![CDATA[33]]></labelWindowIndex>
<objectComment><![CDATA[A phone number that has been assigned to an account]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
@@ -2883,17 +2901,17 @@
<overviewPanelHidden><![CDATA[0]]></overviewPanelHidden>
<pageBoundariesVisible><![CDATA[0]]></pageBoundariesVisible>
<PageGridVisible><![CDATA[0]]></PageGridVisible>
<RightSidebarWidth><![CDATA[1681.000000]]></RightSidebarWidth>
<RightSidebarWidth><![CDATA[1235.000000]]></RightSidebarWidth>
<sidebarIndex><![CDATA[2]]></sidebarIndex>
<snapToGrid><![CDATA[0]]></snapToGrid>
<SourceSidebarWidth><![CDATA[312.000000]]></SourceSidebarWidth>
<SourceSidebarWidth><![CDATA[0.000000]]></SourceSidebarWidth>
<SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion>
<uid><![CDATA[58C99A00-06C9-478C-A667-C63842E088F3]]></uid>
<windowHeight><![CDATA[1055.000000]]></windowHeight>
<windowHeight><![CDATA[870.000000]]></windowHeight>
<windowLocationX><![CDATA[0.000000]]></windowLocationX>
<windowLocationY><![CDATA[24.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{387.5, 130}]]></windowScrollOrigin>
<windowWidth><![CDATA[1682.000000]]></windowWidth>
<windowLocationY><![CDATA[74.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{0, 692.5}]]></windowScrollOrigin>
<windowWidth><![CDATA[1512.000000]]></windowWidth>
</SQLDocumentInfo>
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>
<defaultLabelExpanded><![CDATA[1]]></defaultLabelExpanded>

View File

@@ -144,7 +144,9 @@ const sql = {
'alter table accounts add column record_all_calls BOOLEAN NOT NULL DEFAULT false',
'alter table accounts add column bucket_credential VARCHAR(8192)',
'alter table accounts add column record_format VARCHAR(16) NOT NULL DEFAULT `mp3`',
'alter table applications add column record_all_calls BOOLEAN NOT NULL DEFAULT false'
'alter table applications add column record_all_calls BOOLEAN NOT NULL DEFAULT false',
'alter table phone_numbers DROP INDEX number',
'create unique index phone_numbers_unique_idx_voip_carrier_number ON phone_numbers (number,voip_carrier_sid)'
]
};