2023-05-30 23:04:03 +00:00
|
|
|
create table if not exists da_groups (
|
2023-06-04 18:50:36 +00:00
|
|
|
da_name varchar(20) not null,
|
|
|
|
da_comment varchar(100) default null,
|
|
|
|
constraint da_groups_pk primary key (da_name)
|
2023-05-29 14:40:53 +00:00
|
|
|
);
|
|
|
|
|
2023-05-30 23:04:03 +00:00
|
|
|
insert into da_groups (da_name, da_comment)
|
2023-06-04 18:50:36 +00:00
|
|
|
values
|
|
|
|
('general', 'Общие контакты'),
|
|
|
|
('work', 'Рабочие контакты'),
|
|
|
|
('personal', 'Личные контакты');
|
2023-05-29 14:40:53 +00:00
|
|
|
|
2023-05-30 23:04:03 +00:00
|
|
|
create table if not exists da_lists (
|
2023-06-04 18:50:36 +00:00
|
|
|
da_name varchar(20) not null,
|
|
|
|
da_comment varchar(100) default null,
|
|
|
|
constraint da_lists_pk primary key (da_name)
|
2023-05-29 14:40:53 +00:00
|
|
|
);
|
|
|
|
|
2023-05-30 23:04:03 +00:00
|
|
|
insert into da_lists (da_name, da_comment)
|
2023-06-04 18:50:36 +00:00
|
|
|
values
|
|
|
|
('general', 'Общий'),
|
|
|
|
('whitelist', 'Белый'),
|
|
|
|
('blacklist', 'Черный');
|
2023-05-29 14:40:53 +00:00
|
|
|
|
2023-05-30 23:04:03 +00:00
|
|
|
create table if not exists da_numbers (
|
2023-06-04 18:50:36 +00:00
|
|
|
da_number varchar(12) not null,
|
|
|
|
da_group varchar(20) not null default 'general',
|
|
|
|
da_list varchar(20) not null default 'general',
|
|
|
|
da_all_cc int not null default 0,
|
|
|
|
da_white_cc int not null default 0,
|
|
|
|
da_black_cc int not null default 0,
|
|
|
|
da_comment varchar(100) default null,
|
|
|
|
constraint da_numbers_pk primary key (da_number),
|
|
|
|
foreign key (da_group) references da_groups (da_name) on delete set null on update cascade,
|
|
|
|
foreign key (da_list) references da_lists (da_name) on delete set null on update cascade
|
2023-05-29 14:40:53 +00:00
|
|
|
);
|
|
|
|
|
2023-05-30 23:04:03 +00:00
|
|
|
create table if not exists da_sms (
|
|
|
|
da_id bigserial not null,
|
|
|
|
da_date timestamp not null default NOW(),
|
|
|
|
da_to varchar(12) not null,
|
|
|
|
da_from varchar(12) not null,
|
|
|
|
da_text text not null,
|
|
|
|
constraint da_sms_pk primary key (da_id)
|
2023-05-29 14:40:53 +00:00
|
|
|
);
|
|
|
|
|
2023-06-03 23:00:19 +00:00
|
|
|
create table if not exists da_ussd_type (
|
|
|
|
da_id bigserial not null,
|
|
|
|
da_comment varchar(100) not null,
|
|
|
|
constraint da_ussd_type_pk primary key (da_id)
|
|
|
|
);
|
|
|
|
|
|
|
|
insert into da_ussd_type (da_id, da_comment)
|
2023-06-04 18:50:36 +00:00
|
|
|
values
|
|
|
|
('0', 'Уведомление'),
|
|
|
|
('1', 'Запрос'),
|
|
|
|
('2', 'Прервано сетью'),
|
|
|
|
('3', 'Ответ другого локального клиента'),
|
|
|
|
('4', 'Операция не поддерживается'),
|
|
|
|
('5', 'Тайм-аут сети');
|
2023-06-03 23:00:19 +00:00
|
|
|
|
2023-05-30 23:04:03 +00:00
|
|
|
create table if not exists da_ussd (
|
|
|
|
da_id bigserial not null,
|
|
|
|
da_date timestamp not null default NOW(),
|
|
|
|
da_to varchar(12) not null,
|
|
|
|
da_type smallint not null,
|
|
|
|
da_text text not null,
|
|
|
|
constraint da_ussd_pk primary key (da_id)
|
2023-05-29 14:40:53 +00:00
|
|
|
);
|
|
|
|
|
2023-05-30 23:04:03 +00:00
|
|
|
create table if not exists da_server (
|
2023-06-04 18:50:36 +00:00
|
|
|
da_id int not null default 1,
|
2023-05-30 23:04:03 +00:00
|
|
|
da_transparent_mode bool not null default false,
|
|
|
|
da_internal_number varchar(12) not null,
|
|
|
|
da_external_number varchar(12) not null,
|
2023-06-04 18:50:36 +00:00
|
|
|
da_external_number_on bool not null default true,
|
|
|
|
constraint da_server_pk primary key (da_id)
|
2023-05-29 14:40:53 +00:00
|
|
|
);
|