/* Server version: WI-V6.3.0.26074 Firebird 2.5 
   SQLDialect: 3. ODS: 11.2. Forced writes: On. Sweep inteval: 20000.
   Page size: 4096. Cache pages: 2048 (8192 Kb). Read-only: False. */
SET NAMES WIN1251;

SET SQL DIALECT 3;

CONNECT 'c:\WORK\ftp_dlv_rk7\3.1.3.140\DB\DELIVERYRK7.FDB' USER 'SYSDBA' PASSWORD 'masterkey';

SET AUTODDL ON;

/* Create Table... */
CREATE TABLE DLV_CALL_LOG(CALL_ID D_INT64 NOT NULL,
PHONE_NUM D_STRING_40,
OPERATOR_ID D_INTEGER,
OPERATOR_NAME D_STRING_100,
RK7CASH_ID D_INTEGER,
RK7CASH_NAME D_STRING_50,
START_TIME D_DATETIME DEFAULT current_timestamp,
END_TIME D_DATETIME,
ANSWERED_TIME D_DATETIME,
CALLBACK_TIME D_DATETIME);



ALTER TABLE DLV_RESTAURANTS ADD TIMEZONE D_INTEGER;

ALTER TABLE DLV_RESTAURANTS ADD CCDIFF D_INTEGER;




/* String-length truncation not supported:
ALTER TABLE DLV_ORDERS ALTER COLUMN RK7GUID TYPE D_GUIDSTR */

/* Create index... */
CREATE INDEX DLV_CALL_LOG_IDX_CASH ON DLV_CALL_LOG(RK7CASH_ID);

CREATE INDEX DLV_CALL_LOG_IDX_END ON DLV_CALL_LOG(END_TIME);

CREATE INDEX DLV_CALL_LOG_IDX_OPER ON DLV_CALL_LOG(OPERATOR_ID);

CREATE INDEX DLV_CALL_LOG_IDX_PHONE ON DLV_CALL_LOG(PHONE_NUM);

CREATE INDEX DLV_CALL_LOG_IDX_START ON DLV_CALL_LOG(START_TIME);


/* Create generator... */
CREATE GENERATOR GEN_DLV_CALL_LOG_ID;


/* Create Primary Key... */
ALTER TABLE DLV_CALL_LOG ADD CONSTRAINT PK_DLV_CALL_LOG PRIMARY KEY (CALL_ID);

/* Create(Add) Crant */
GRANT ALL ON DLV_CALL_LOG TO SYSDBA WITH GRANT OPTION;


