--ABS-164690
--comment changes due to ABSN-2299
/*
CREATE SEQUENCE SEQ_REST_VIEWS
START WITH 1
INCREMENT BY 1;

CREATE TABLE REST_VIEWS
(
  VIEW_ID       NUMBER DEFAULT SEQ_REST_VIEWS.NEXTVAL NOT NULL,
  VIEW_RESTNAME VARCHAR2(128) NOT NULL,
  VIEW_NAME     VARCHAR2(128) NOT NULL,
  WHERE_CLAUSE  VARCHAR2(1000) NULL,
  ORDER_BY      VARCHAR2(128) NULL
);
ALTER TABLE REST_VIEWS
  ADD CONSTRAINT PK_REST_VIEWS PRIMARY KEY (VIEW_ID);
ALTER TABLE REST_VIEWS
  ADD CONSTRAINT PK2_REST_VIEWS UNIQUE (VIEW_ID, VIEW_RESTNAME);
ALTER TABLE REST_VIEWS
  ADD CONSTRAINT PK3_REST_VIEWS UNIQUE (VIEW_RESTNAME);
ALTER TABLE REST_VIEWS
  ADD CONSTRAINT CHK_REST_VIEWS_VIEW_RESTNAME
  CHECK (VIEW_RESTNAME = LOWER(VIEW_RESTNAME));

CREATE TABLE REST_VIEWS_PARAMETERS
(
  VIEW_ID               NUMBER NOT NULL,
  VIEW_RESTNAME         VARCHAR2(128) NOT NULL,
  VIEW_FIELDNAME        VARCHAR2(128) NOT NULL,
  PARAMETER             VARCHAR2(128) NOT NULL,
  PARAMETERTYPE         VARCHAR2(32) NOT NULL,
  PARAMETER_CONDITION   VARCHAR2(16) DEFAULT '=' NOT NULL,
  PARAMETER_OPTIONAL_YN VARCHAR2(1) DEFAULT 'Y' NOT NULL,
  PARAMETER_SHOW_YN     VARCHAR2(1) DEFAULT 'Y' NOT NULL,  
  PARAMETER_BETWEEN2    VARCHAR2(128) NULL,
  CONDITION_IN          VARCHAR2(1000) NULL
);
ALTER TABLE REST_VIEWS_PARAMETERS
  ADD CONSTRAINT PK_REST_VIEWS_PARAMETERS PRIMARY KEY (VIEW_ID, VIEW_FIELDNAME);
ALTER TABLE REST_VIEWS_PARAMETERS
  ADD CONSTRAINT PK2_REST_VIEWS_PARAMETERS UNIQUE (VIEW_ID, PARAMETER);  
CREATE INDEX INDX_REST_VIEWS_PARAMETERS_01 ON REST_VIEWS_PARAMETERS (VIEW_ID, VIEW_RESTNAME);  
ALTER TABLE REST_VIEWS_PARAMETERS
  ADD CONSTRAINT FK_REST_VIEWS_PARAMETERS FOREIGN KEY (VIEW_ID, VIEW_RESTNAME)
  REFERENCES REST_VIEWS (VIEW_ID, VIEW_RESTNAME);
ALTER TABLE REST_VIEWS_PARAMETERS
  ADD CONSTRAINT CHK_REST_VIEWS_PARAMETERTYPE
  CHECK (PARAMETERTYPE IN ('DATE', 'NUMBER', 'VARCHAR2'));
ALTER TABLE REST_VIEWS_PARAMETERS
  ADD CONSTRAINT CHK_REST_VIEWS_PARAMETER_CONDITION
  CHECK (PARAMETER_CONDITION IN ('=','>','<','>=','<=','BETWEEN','IN'));
ALTER TABLE REST_VIEWS_PARAMETERS
  ADD CONSTRAINT CHK_REST_VIEWS_PARAMETER_OPTIONAL_YN
  CHECK (PARAMETER_OPTIONAL_YN IN ('Y','N'));
ALTER TABLE REST_VIEWS_PARAMETERS
  ADD CONSTRAINT CHK_REST_VIEWS_PARAMETER_SHOW_YN
  CHECK (PARAMETER_SHOW_YN IN ('Y','N'));
ALTER TABLE REST_VIEWS_PARAMETERS
  ADD CONSTRAINT CHK_REST_VIEWS_PARAMETER_BETWEEN2
  CHECK ((PARAMETER_BETWEEN2 IS NULL OR PARAMETER_CONDITION = 'BETWEEN'));
ALTER TABLE REST_VIEWS_PARAMETERS
  ADD CONSTRAINT CHK_REST_VIEWS_PARAMETER_CONDITION_IN
  CHECK ((CONDITION_IN IS NULL OR CONDITION_IN = 'IN'));
COMMENT ON COLUMN REST_VIEWS_PARAMETERS.PARAMETER_OPTIONAL_YN
  IS 'When NOT optional, then this parameter must be used or no data is being returned!';
*/
