/**Begin D:\utils\PDM_UPGRADE\PDM_UPGRADE\PDM1\HBSS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_ACTION')
CREATE TABLE T_HBSS_ACTION (
                               FID BIGINT DEFAULT 0 NOT NULL,
                               FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
                               FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
                               FSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
                               FENABLE VARCHAR(2) DEFAULT ' ' NOT NULL,
                               FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
                               FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
                               FACTIONTYPEID BIGINT DEFAULT 0 NOT NULL,
                               FCREATORID BIGINT DEFAULT 0 NOT NULL,
                               FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
                               FCREATETIME DATETIME,
                               FMODIFYTIME DATETIME,
                               FMASTERID BIGINT DEFAULT 0 NOT NULL,
                               FINDEX INT DEFAULT 0 NOT NULL,
                               FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
                               FDISABLERID BIGINT DEFAULT 0 NOT NULL,
                               FDISABLEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_ACTION_L')
CREATE TABLE T_HBSS_ACTION_L (
                                 FID BIGINT DEFAULT 0 NOT NULL,
                                 FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
                                 FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
                                 FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
                                 FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
                                 FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_ACTIONTYPE')
CREATE TABLE T_HBSS_ACTIONTYPE (
                                   FID BIGINT DEFAULT 0 NOT NULL,
                                   FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
                                   FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
                                   FSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
                                   FENABLE VARCHAR(2) DEFAULT ' ' NOT NULL,
                                   FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
                                   FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                   FBUSINESSDOMAINID BIGINT DEFAULT 0 NOT NULL,
                                   FCREATORID BIGINT DEFAULT 0 NOT NULL,
                                   FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
                                   FCREATETIME DATETIME,
                                   FMODIFYTIME DATETIME,
                                   FMASTERID BIGINT DEFAULT 0 NOT NULL,
                                   FINDEX INT DEFAULT 0 NOT NULL,
                                   FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
                                   FDISABLERID BIGINT DEFAULT 0 NOT NULL,
                                   FDISABLEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_ACTIONTYPE_L')
CREATE TABLE T_HBSS_ACTIONTYPE_L (
                                     FID BIGINT DEFAULT 0 NOT NULL,
                                     FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
                                     FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
                                     FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
                                     FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
                                     FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);



/**End D:\utils\PDM_UPGRADE\PDM_UPGRADE\PDM1\HBSS_table.sql **/
/**Begin D:\utils\PDM_UPGRADE\PDM_UPGRADE\PDM1\HBSS_constraint.sql **/
EXEC P_ALTERPK 'PK_HBSS_ACTION', 'T_HBSS_ACTION', 'FID', '1';

EXEC P_ALTERPK 'PK_HBSS_ACTION_L', 'T_HBSS_ACTION_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_ACTION_L') CREATE INDEX IDX_HBSS_ACTION_L ON T_HBSS_ACTION_L ( FLOCALEID ,FID );


EXEC P_ALTERPK 'PK_HBSS_ACTIONTYPE', 'T_HBSS_ACTIONTYPE', 'FID', '1';

EXEC P_ALTERPK 'PK_HBSS_ACTIONTYPE_L', 'T_HBSS_ACTIONTYPE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_ACTIONTYPE_L') CREATE INDEX IDX_HBSS_ACTIONTYPE_L ON T_HBSS_ACTIONTYPE_L ( FLOCALEID ,FID );



/**End D:\utils\PDM_UPGRADE\PDM_UPGRADE\PDM1\HBSS_constraint.sql **/
-- 修改索引
/**Begin D:\utils\PDM_UPGRADE\PDM_UPGRADE\PDM1\HBSS_constraint.sql **/
EXEC p_DropIdx 'IDX_HBSS_ACTION', 'T_HBSS_ACTION';
EXEC p_DropIdx 'IDX_HBSS_ACTION_FNUMBER', 'T_HBSS_ACTION';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_ACTION_FNUMBER') CREATE INDEX IDX_HBSS_ACTION_FNUMBER ON T_HBSS_ACTION ( FNUMBER );

EXEC p_DropIdx 'IDX_HBSS_ACTION_FNAME', 'T_HBSS_ACTION';
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_ACTION_FNAME') CREATE INDEX IDX_HBSS_ACTION_FNAME ON T_HBSS_ACTION ( FNAME );

EXEC p_DropIdx 'IDX_HBSS_ACTIONTYPE', 'T_HBSS_ACTIONTYPE';
EXEC p_DropIdx 'IDX_HBSS_ACTIONTYPE_FNUMBER', 'T_HBSS_ACTIONTYPE';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_ACTIONTYPE_FNUMBER') CREATE INDEX IDX_HBSS_ACTIONTYPE_FNUMBER ON T_HBSS_ACTIONTYPE ( FNUMBER );

EXEC p_DropIdx 'IDX_HBSS_ACTIONTYPE_FNAME', 'T_HBSS_ACTIONTYPE';
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_ACTIONTYPE_FNAME') CREATE INDEX IDX_HBSS_ACTIONTYPE_FNAME ON T_HBSS_ACTIONTYPE ( FNAME );


/**End D:\utils\PDM_UPGRADE\PDM_UPGRADE\PDM1\HBSS_constraint.sql **/

