test(tenant): 增加本地双站演示数据与跨站验收
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BACKEND_DIR="${ROOT_DIR}/backend"
|
||||
MYSQL_DSN="${MYSQL_DSN:-hfb:secret@tcp(127.0.0.1:13306)/hfb_sys?charset=utf8mb4&parseTime=True&loc=Local}"
|
||||
GOOSE_VERSION="${GOOSE_VERSION:-v3.27.1}"
|
||||
GOPROXY="${GOPROXY:-https://goproxy.cn,direct}"
|
||||
|
||||
export GOPROXY
|
||||
|
||||
if [[ "${MYSQL_DSN}" == *"multiStatements=true"* ]]; then
|
||||
GOOSE_DSN="${MYSQL_DSN}"
|
||||
elif [[ "${MYSQL_DSN}" == *"?"* ]]; then
|
||||
GOOSE_DSN="${MYSQL_DSN}&multiStatements=true"
|
||||
else
|
||||
GOOSE_DSN="${MYSQL_DSN}?multiStatements=true"
|
||||
fi
|
||||
|
||||
printf '[tenant-demo] 执行数据库迁移...\n'
|
||||
(
|
||||
cd "${BACKEND_DIR}"
|
||||
go run "github.com/pressly/goose/v3/cmd/goose@${GOOSE_VERSION}" \
|
||||
-dir migrations \
|
||||
mysql "${GOOSE_DSN}" \
|
||||
up
|
||||
)
|
||||
|
||||
printf '[tenant-demo] 写入双站演示数据...\n'
|
||||
(
|
||||
cd "${BACKEND_DIR}"
|
||||
MYSQL_DSN="${MYSQL_DSN}" go run ./cmd/tenant-demo-seed
|
||||
)
|
||||
Reference in New Issue
Block a user