CREATE TABLE CSV_SUBSCRIPTIONS
(
  USER_ID Varchar(32) NOT NULL,
  LOCATION Varchar(255) NOT NULL,
  FILENAME Varchar(255) NOT NULL,
  FREQUENCY Varchar(100) NOT NULL,
  FREQINDEX Decimal(10,4) NOT NULL,
  LASTSEND Timestamp,
  SUBINDEX Integer NOT NULL,
  USE_DEFAULT_TIMESPAN Integer NOT NULL,
  FORCE_SEND Integer NOT NULL,
  REPORT_MISSING Integer NOT NULL,
  PRIMARY KEY (SUBINDEX)
); CREATE GENERATOR GEN_CSV_SUBINDEX; SET TERM ^ ;
CREATE TRIGGER CSV_BEFOREINSERT FOR CSV_SUBSCRIPTIONS ACTIVE
BEFORE INSERT POSITION 0 
AS BEGIN if (NEW.SUBINDEX is NULL) then NEW.SUBINDEX = GEN_ID(GEN_CSV_SUBINDEX, 1); END^
SET TERM ; ^
  CREATE TABLE CSV_SUBSCRIPTIONS_SETTINGS
(
  DEBUG_TIMER Integer DEFAULT 0,
  DEBUG_FIRE Integer DEFAULT 0,
  DEBUG_LINE_DETAIL Integer DEFAULT 0,
  DEBUG_MILESTONES Integer DEFAULT 0,
  DEBUG_DATA_ACCESS Integer DEFAULT 0,
  ROWINDEX Integer NOT NULL
); 
CREATE UNIQUE INDEX IDX_CSV_SUBSCRIPTIONS_SETTINGS1 ON CSV_SUBSCRIPTIONS_SETTINGS (ROWINDEX); COMMIT;