/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BOS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_LIC_ASSIGNLOG') 
 CREATE TABLE T_LIC_ASSIGNLOG (
FID BIGINT DEFAULT 0 NOT NULL,
FOPUSERID BIGINT DEFAULT 0 NOT NULL,
FOPTIME DATETIME,
FASSIGNUSERID BIGINT DEFAULT 0 NOT NULL,
FGROUPID BIGINT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_LIC_LEGALASSIGN') 
 CREATE TABLE T_LIC_LEGALASSIGN (
FID BIGINT DEFAULT 0 NOT NULL,
FGROUPID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FASSIGNEDNUM INT DEFAULT 0 NOT NULL,
FUSEDNUM INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LIC_USERLICENSEGROUP' AND KSQL_COL_NAME ='FORGID') 
 ALTER TABLE T_LIC_USERLICENSEGROUP ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LIC_USERLICENSEGROUPBAK' AND KSQL_COL_NAME ='FORGID') 
 ALTER TABLE T_LIC_USERLICENSEGROUPBAK ADD (FORGID BIGINT DEFAULT 0 NOT NULL );

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BOS_table.sql **/
