/* * Copyright 2016 http://www.hswebframework.org * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ //组件信息 var info = { groupId: "${project.groupId}", artifactId: "${project.artifactId}", version: "${project.version}", website: "https://github.com/hs-web/hsweb-framework/tree/master/hsweb-system/hsweb-system-organizational", author: "admin@hsweb.me", comment: "组织架构" }; //版本更新信息 var versions = [ // { // version: "3.0.0", // upgrade: function (context) { // java.lang.System.out.println("更新到3.0.2了"); // } // } ]; var JDBCType = java.sql.JDBCType; function install(context) { var database = context.database; database.createOrAlter("s_organization") .addColumn().name("u_id").alias("id").comment("ID").jdbcType(java.sql.JDBCType.VARCHAR).length(32).primaryKey().commit() .addColumn().name("name_en").alias("nameEn").comment("名称(英文)").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit() .addColumn().name("leader").alias("leader").comment("机构负责人").jdbcType(java.sql.JDBCType.VARCHAR).length(256).commit() .addColumn().name("other_property").alias("otherProperty").comment("其他属性").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit() .comment("组织机构表").commit(); database.createOrAlter("s_user") .addColumn().name("u_id").alias("id").comment("ID").jdbcType(java.sql.JDBCType.VARCHAR).length(32).primaryKey().commit() .addColumn().name("nick_name").alias("nickName").comment("昵称").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit() .comment("用户表").commit(); } //设置依赖 dependency.setup(info) .onInstall(install) .onUpgrade(function (context) { //更新时执行 var upgrader = context.upgrader; upgrader.filter(versions) .upgrade(function (newVer) { newVer.upgrade(context); }); }) .onUninstall(function (context) { //卸载时执行 });