
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_PRODUCTLINE_OPERA')
CREATE TABLE T_FMM_PRODUCTLINE_OPERA (
	FID               BIGINT          NOT NULL DEFAULT 0,
	FNUMBER           VARCHAR(30)     NOT NULL DEFAULT ' ',
	FNAME             VARCHAR(50)     NOT NULL DEFAULT ' ',
	FSTATUS           VARCHAR(50)     NOT NULL DEFAULT ' ',
	FCREATORID        BIGINT          NULL,
	FMODIFIERID       BIGINT          NULL,
	FENABLE           VARCHAR(50)     NOT NULL DEFAULT ' ',
	FCREATETIME       DATETIME        NULL,
	FMODIFYTIME       DATETIME        NULL,
	FMASTERID         BIGINT          NULL,
	FCREATEORGID      BIGINT          NULL,
	FORGID            BIGINT          NULL,
	FCTRLSTRATEGY     VARCHAR(50)     NOT NULL DEFAULT ' ',
	FSOURCEDATAID     BIGINT          NULL,
	FBITINDEX         BIGINT          NULL,
	FSOURCEBITINDEX   BIGINT          NULL,
	FPROLINE          BIGINT          NULL,
	CONSTRAINT PK_FMM_PRODUCTLINE_OPERA PRIMARY KEY (FID)
);
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_FMM_PRODUCTLINE_OPERA_CREATEORG')
CREATE INDEX IDX_T_FMM_PRODUCTLINE_OPERA_CREATEORG ON T_FMM_PRODUCTLINE_OPERA (FCREATEORGID);
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_FMM_PRODUCTLINE_OPERA_MASTER')
CREATE INDEX IDX_T_FMM_PRODUCTLINE_OPERA_MASTER ON T_FMM_PRODUCTLINE_OPERA (FMASTERID);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PROSEQ_ENTRYENTITY')
CREATE TABLE T_PROSEQ_ENTRYENTITY (
	FID                     BIGINT        NOT NULL DEFAULT 0,
	FENTRYID                BIGINT        NOT NULL DEFAULT 0,
	FSEQ                    INT           DEFAULT 0 NOT NULL,
	FSTEPSEQ                BIGINT        NULL,
	FSTEP                   CHAR(1)       NOT NULL DEFAULT '0',
	FMILESTONE              CHAR(1)       NOT NULL DEFAULT '0',
	FPARENTNEW              varchar(255)  NOT NULL DEFAULT ' ',
	FSTEPNUM                BIGINT        NULL,
	CONSTRAINT PK_PROSEQ_ENTRYENTITY PRIMARY KEY (FENTRYID)
);
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PROSEQ_ENTRYENTITY_FK')
CREATE INDEX IDX_PROSEQ_ENTRYENTITY_FK ON T_PROSEQ_ENTRYENTITY (FID);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_PRODUCTLINE_OPERA_L')
CREATE TABLE T_FMM_PRODUCTLINE_OPERA_L (
	FPKID        VARCHAR(36)   NOT NULL,
	FID          BIGINT        NOT NULL DEFAULT 0,
	FLOCALEID    VARCHAR(10)   NOT NULL DEFAULT ' ',
	FNAME        VARCHAR(50)   NOT NULL DEFAULT ' ',
	CONSTRAINT PK_FMM_PRODUCTLINE_OPERA_L PRIMARY KEY (FPKID)
);
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PRODUCTLINE_OPERA_L_0')
CREATE INDEX IDX_FMM_PRODUCTLINE_OPERA_L_0 ON T_FMM_PRODUCTLINE_OPERA_L (FID, FLOCALEID);