#!/bin/bash # 使用方法, 直接执行该脚本更新所有表, cmd_db.sh 表名, 如 ./cmd_db.sh tableName Table=* TName="" if [ "$1" ] ;then Table=$1 TName="^$1$" fi BasePath="./" DBUSER="root" DBPSW="Fnuo123com@" DBNAME="smart_canteen" DBHOST="119.23.182.117" DBPORT="3306" rm -rf $BasePath/app/db/model/$Table.go && \ xorm reverse mysql "$DBUSER:$DBPSW@tcp($DBHOST:$DBPORT)/$DBNAME?charset=utf8" $BasePath/etc/db_tpl $BasePath/app/db/model/ $TName