HZERO數(shù)據(jù)庫初始化

表及數(shù)據(jù)初始化

hzero-resource

1.表結(jié)構(gòu)及初始數(shù)據(jù)在 hzero-resource 項目下,請自行下載,并切換到對應(yīng)版本分支上進行安裝。官方文檔操作鏈接

    1> groovy:表結(jié)構(gòu) groovy 腳本,提供了每個服務(wù)的表結(jié)構(gòu)
    2> init-data:初始化數(shù)據(jù),按服務(wù)劃分基礎(chǔ)數(shù)據(jù)
    3> tool-jar:執(zhí)行初始化安裝的工具
    4> database-init.sh:交互式執(zhí)行初始化的腳本
    

2.下載下來 hzero-resource 打開程序

#!/usr/bin/env bash
mkdir -p tool-jar
if [ ! -f tool-jar/hzero-tool-liquibase.jar ]
then
    curl http://nexus.saas.hand-china.com/content/repositories/Hzero-Release/org/hzero/tool/liquibase-tool/1.0.0.RELEASE/liquibase-tool-1.0.0.RELEASE.jar -o ./tool-jar/hzero-tool-liquibase.jar
fi

# 指定更新的服務(wù),用下劃線分隔
service=hzero_platform
# 更新的 schema
schema=$service
# 更新的目錄,Groovy 腳本在 groovy 目錄下,Excel 期初數(shù)據(jù)在 init-data 目錄下

dir=init-data/$service/platform/op


java -Dspring.datasource.url="jdbc:mysql://127.0.0.1:3306/$service?useUnicode=true&characterEncoding=utf-8&useSSL=false" \
     -Dspring.datasource.username=root \
     -Dspring.datasource.password=orcl \
     -Ddata.drop=false \
     -Ddata.init=true \
     -Ddata.dir=$dir \
     -Ddata.update.exclusion=iam_role,fd_organization,iam_user,hiam_user_info,iam_member_role,oauth_client,oauth_ldap,oauth_password_policy,hpfm_permission_rule,hpfm_permission_rel,hpfm_config,hpfm_code_rule,hpfm_code_rule,hpfm_code_rule_detail,hpfm_static_text,hpfm_static_text_value,hpfm_tenant,hpfm_group,hmsg_email_server,hmsg_email_property,hmsg_sms_server,hmsg_receive_config,hmsg_receiver_type,hmsg_message_template.template_content,hmsg_message_template.external_code \
     -Dlogging.level.root=info \
     -jar tool-jar/hzero-tool-liquibase.jar
1. 打開 database-init.sh 腳本
   配置 datasource 為本地的數(shù)據(jù)庫 
2. 修改配置 dir 目錄
   查詢找到 Groovy腳本 目錄 選擇自己需要執(zhí)行的 目錄地址(我選擇的是groovy/hzero_platform)
   因此dir地址變?yōu)?  dir=groovy/$service
   
   執(zhí)行database-init.sh腳本
 3. 創(chuàng)建完成表結(jié)構(gòu)后 更換 dir的數(shù)據(jù) 數(shù)據(jù)初始化
    dir=init-data/$service/platform/op
    
    再次執(zhí)行腳本  
    
 4.完成數(shù)據(jù)庫初始化操作

3.初始化 oracle 只需要對 spring.datasource 進行替換


?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容