
CREATE TABLE BPM_INSTANCE(
	ID BIGINT NOT NULL,
	NAME VARCHAR(200),
	BUSINESS_KEY VARCHAR(64),
	REF VARCHAR(64),
	CREATE_TIME DATETIME,
	INITIATOR VARCHAR(64),
	PRIORITY INTEGER,
	TENANT_ID VARCHAR(64),
	PROCESS_ID BIGINT,
        CONSTRAINT PK_BPM_INSTANCE PRIMARY KEY(ID),
        CONSTRAINT FK_BPM_INSTANCE_PROCESS FOREIGN KEY(PROCESS_ID) REFERENCES BPM_PROCESS(ID)
);

COMMENT ON TABLE BPM_INSTANCE IS '流程实例';
COMMENT ON COLUMN BPM_INSTANCE.ID IS '主键';
COMMENT ON COLUMN BPM_INSTANCE.NAME IS '名称';
COMMENT ON COLUMN BPM_INSTANCE.BUSINESS_KEY IS '业务标识';
COMMENT ON COLUMN BPM_INSTANCE.REF IS '外部引用';
COMMENT ON COLUMN BPM_INSTANCE.CREATE_TIME IS '创建时间';
COMMENT ON COLUMN BPM_INSTANCE.INITIATOR IS '发起人';
COMMENT ON COLUMN BPM_INSTANCE.PRIORITY IS '优先级';
COMMENT ON COLUMN BPM_INSTANCE.TENANT_ID IS '租户';
COMMENT ON COLUMN BPM_INSTANCE.PROCESS_ID IS '外键，流程定义';

