P8-Panels/db/P8PNL_SETTINGS.sql

30 lines
2.6 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
Парус 8 - Панели мониторинга
Параметры панелей
*/
create table P8PNL_SETTINGS
(
RN number(17) not null, -- Рег. номер записи
CODE varchar2(40) not null, -- Мнемокод параметра
NAME varchar2(240) not null, -- Наименование параметра
KIND number(1) not null -- Вид параметра
constraint C_P8PNL_SETTINGS_KIND_VAL check ( KIND in (0,1,2) ),
PANEL varchar2(100) default null, -- Код панели
COMPANY number(17) default null, -- Рег. номер организации
AUTHID varchar2(30) default null, -- Пользователь
OPTIONS clob, -- Дополнительные параметры
DATA_TYPE number(1) default 0 -- Тип данных
constraint C_P8PNL_SETTINGS_DT_VAL check ( DATA_TYPE in (0,1,2) ),
VALUE_STR varchar2(4000) default null, -- Значение (строка)
VALUE_NUM number default null, -- Значение (число)
VALUE_DATE date default null, -- Значение (дата)
DESCRIPTION varchar2(240) default null, -- Примечание
constraint C_P8PNL_SETTINGS_PK primary key (RN),
constraint C_P8PNL_SETTINGS_UK unique (CODE, PANEL, COMPANY, AUTHID),
constraint C_P8PNL_SETTINGS_DATA_TYPE_CH check (((DATA_TYPE = 0) and ((VALUE_NUM is null) and (VALUE_DATE is null)))
or ((DATA_TYPE = 1) and ((VALUE_STR is null) and (VALUE_DATE is null)))
or ((DATA_TYPE = 2) and ((VALUE_STR is null) and (VALUE_NUM is null)))),
constraint C_P8PNL_SETTINGS_KIND_CH check (((KIND = 0) and ((PANEL is null) and (COMPANY is null) and (AUTHID is null)))
or ((KIND = 1) and ((PANEL is not null) and (COMPANY is null) and (AUTHID is not null)))
or ((KIND = 2) and ((PANEL is not null) and (COMPANY is not null) and (AUTHID is not null))))
);