执行数据库脚本
基于命令行执行如下数据库脚本。如果知道自己所用平台的版本号可以将脚本中版本1.1.1替换成实际版本号。此脚本只适用于1.1.1至1.1.6升级到最新版本。1.2.0及以后版本升级可以忽略此步。
本文档以升级至版本1.2.3为例。
Oracle脚本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
alter table XIP_PUB_APPS add version VARCHAR2(20); comment on column XIP_PUB_APPS.version is '应用版本号'; update xip_pub_apps set version = '1.1.1' where app_code = 'XIP'; CREATE TABLE WB6_META ( META_NAME VARCHAR2(30) NOT NULL, META_TYPE VARCHAR2(50) NOT NULL, META_CONTENT CLOB NOT NULL, ORDER_INDEX NUMBER(6,0) NOT NULL ); ALTER TABLE WB6_META ADD CONSTRAINT WB6_META PRIMARY KEY (META_NAME); CREATE INDEX WB6_META_IDX ON WB6_META (ORDER_INDEX); CREATE TABLE WB6_VAR ( VAR_ID VARCHAR2(12) NOT NULL, PARENT_ID VARCHAR2(12) NOT NULL, VAR_NAME VARCHAR2(50) NOT NULL, VAR_VALUE VARCHAR2(255), IS_VAR NUMBER(1,0) ); ALTER TABLE WB6_VAR ADD CONSTRAINT WB6_VAR PRIMARY KEY (VAR_ID); CREATE TABLE WB6_KEY ( KEY_ID VARCHAR2(12) NOT NULL, KEY_TYPE VARCHAR2(50) NOT NULL, KEY_NAME VARCHAR2(50) NOT NULL, KEY_VALUE VARCHAR2(200) NOT NULL ); ALTER TABLE WB6_KEY ADD CONSTRAINT WB6_KEY PRIMARY KEY (KEY_ID); CREATE INDEX WB6_KEY_IDX ON WB6_KEY (KEY_TYPE); CREATE TABLE WB6_VALUE ( VAL_ID VARCHAR2(200) NOT NULL, VAL_CONTENT VARCHAR2(255) ); ALTER TABLE WB6_VALUE ADD CONSTRAINT WB6_VALUE PRIMARY KEY (VAL_ID); insert into wb6_key select * from wb_key; insert into wb6_meta select * from wb_meta; insert into wb6_var select * from wb_var; commit; drop table wb_cust; drop table wb_key; drop table wb_log; drop table wb_meta; drop table wb_resource; drop table wb_module_role; drop table wb_value; drop table wb_var; drop table wb_task; drop table wb_sysinfo; drop table wb_sale; drop table wb_user_role; drop table wb_role; drop table wb_user; CREATE TABLE XIP_PUB_UPGRADE_LOGS ( UPD_VER VARCHAR2(500) NOT NULL, UPD_OPT VARCHAR2(200) NOT NULL, UPD_START_DATE DATE NOT NULL, UPD_END_DATE DATE NOT NULL, UPD_FLAG VARCHAR2(3) NOT NULL, UPD_DESC VARCHAR2(4000), ATTRIBUTE1 VARCHAR2(250), ATTRIBUTE2 VARCHAR2(250), ATTRIBUTE3 VARCHAR2(250), ATTRIBUTE4 VARCHAR2(250), ATTRIBUTE5 VARCHAR2(250), ATTRIBUTE6 VARCHAR2(250), ATTRIBUTE7 VARCHAR2(250), ATTRIBUTE8 VARCHAR2(250), ATTRIBUTE9 VARCHAR2(250), ATTRIBUTE10 VARCHAR2(250), CREATION_DATE DATE, CREATED_BY VARCHAR2(36), LAST_UPDATE_DATE DATE, LAST_UPDATED_BY VARCHAR2(36), LAST_UPDATE_LOGIN VARCHAR2(36) ); COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.UPD_VER IS '系统版本号'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.UPD_OPT IS '升级选项:1-DDL差异脚本,2-CRUD数据库脚本,3-初始化数据,4-差异化数据,5-WB模块信息'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.UPD_START_DATE IS '开始时间'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.UPD_END_DATE IS '结束时间'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.UPD_FLAG IS '升级标志:S-成功,F-失败'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.UPD_DESC IS '升级失败原因'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.ATTRIBUTE1 IS '弹性扩展字段1'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.ATTRIBUTE2 IS '弹性扩展字段2'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.ATTRIBUTE3 IS '弹性扩展字段3'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.ATTRIBUTE4 IS '弹性扩展字段4'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.ATTRIBUTE5 IS '弹性扩展字段5'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.ATTRIBUTE6 IS '弹性扩展字段6'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.ATTRIBUTE7 IS '弹性扩展字段7'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.ATTRIBUTE8 IS '弹性扩展字段8'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.ATTRIBUTE9 IS '弹性扩展字段9'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.ATTRIBUTE10 IS '弹性扩展字段10'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.CREATION_DATE IS '创建日期'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.CREATED_BY IS '创建人'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.LAST_UPDATE_DATE IS '最后更新日期'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.LAST_UPDATED_BY IS '最后更新人'; COMMENT ON COLUMN XIP_PUB_UPGRADE_LOGS.LAST_UPDATE_LOGIN IS '最后更新登陆ID'; COMMENT ON TABLE XIP_PUB_UPGRADE_LOGS IS '系统升级日志'; |
Mysql脚本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
ALTER TABLE xip_pub_apps ADD COLUMN VERSION varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '应用版本号'; update xip_pub_apps set version = '1.1.1' where app_code ='XIP'; CREATE TABLE WB6_KEY ( KEY_ID VARCHAR(12) NOT NULL PRIMARY KEY, KEY_TYPE VARCHAR(50) NOT NULL, KEY_NAME VARCHAR(50) NOT NULL, KEY_VALUE VARCHAR(200) NOT NULL ); CREATE INDEX WB6_KEY_IDX ON WB6_KEY(KEY_TYPE); CREATE TABLE WB6_META ( META_NAME VARCHAR(30) NOT NULL PRIMARY KEY, META_TYPE VARCHAR(50) NOT NULL, META_CONTENT LONGTEXT NOT NULL, ORDER_INDEX NUMERIC(6) NOT NULL ); CREATE INDEX WB6_META_IDX ON WB6_META(ORDER_INDEX); CREATE TABLE WB6_VALUE ( VAL_ID VARCHAR(200) NOT NULL PRIMARY KEY, VAL_CONTENT VARCHAR(255) ); CREATE TABLE WB6_VAR ( VAR_ID VARCHAR(12) NOT NULL PRIMARY KEY, PARENT_ID VARCHAR(12) NOT NULL, VAR_NAME VARCHAR(50) NOT NULL, VAR_VALUE VARCHAR(255), IS_VAR NUMERIC(1) ); insert into wb6_key select * from wb_key; insert into wb6_meta select * from wb_meta; insert into wb6_var select * from wb_var; commit; drop table wb_cust; drop table wb_key; drop table wb_log; drop table wb_meta; drop table wb_resource; drop table wb_module_role; drop table wb_value; drop table wb_var; drop table wb_task; drop table wb_sysinfo; drop table wb_sale; drop table wb_user_role; drop table wb_role; drop table wb_user; CREATE TABLE XIP_PUB_UPGRADE_LOGS ( UPD_VER VARCHAR(500) NOT NULL COMMENT '系统版本号' , UPD_OPT VARCHAR(200) NOT NULL COMMENT '升级选项:1-DDL差异脚本,2-CRUD数据库脚本,3-初始化数据,4-差异化数据,5-WB模块信息' , UPD_START_DATE DATETIME NOT NULL COMMENT '开始时间' , UPD_END_DATE DATETIME NOT NULL COMMENT '结束时间' , UPD_FLAG VARCHAR(3) NOT NULL COMMENT '升级标志:S-成功,F-失败' , UPD_DESC VARCHAR(4000) COMMENT '升级失败原因' , ATTRIBUTE1 VARCHAR(250) COMMENT '弹性扩展字段1' , ATTRIBUTE2 VARCHAR(250) COMMENT '弹性扩展字段2' , ATTRIBUTE3 VARCHAR(250) COMMENT '弹性扩展字段3' , ATTRIBUTE4 VARCHAR(250) COMMENT '弹性扩展字段4' , ATTRIBUTE5 VARCHAR(250) COMMENT '弹性扩展字段5' , ATTRIBUTE6 VARCHAR(250) COMMENT '弹性扩展字段6' , ATTRIBUTE7 VARCHAR(250) COMMENT '弹性扩展字段7' , ATTRIBUTE8 VARCHAR(250) COMMENT '弹性扩展字段8' , ATTRIBUTE9 VARCHAR(250) COMMENT '弹性扩展字段9' , ATTRIBUTE10 VARCHAR(250) COMMENT '弹性扩展字段10' , CREATION_DATE DATETIME COMMENT '创建日期' , CREATED_BY VARCHAR(36) COMMENT '创建人' , LAST_UPDATE_DATE DATETIME COMMENT '最后更新日期' , LAST_UPDATED_BY VARCHAR(36) COMMENT '最后更新人' , LAST_UPDATE_LOGIN VARCHAR(36) COMMENT '最后更新登陆ID' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE XIP_PUB_UPGRADE_LOGS COMMENT '系统升级日志'; |