All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m20s
23 lines
845 B
Go
23 lines
845 B
Go
package testutil
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// CreateTemporarySystemConfigTable 创建事务内自动回滚的系统配置测试表。
|
|
func CreateTemporarySystemConfigTable(t *testing.T, db *gorm.DB) {
|
|
t.Helper()
|
|
if err := db.Exec(`CREATE TEMP TABLE tb_system_config (
|
|
id bigserial PRIMARY KEY, config_key varchar(150) NOT NULL UNIQUE,
|
|
config_value text NOT NULL, value_type varchar(20) NOT NULL,
|
|
module varchar(100) NOT NULL, description varchar(500) NOT NULL,
|
|
is_readonly boolean NOT NULL DEFAULT false, is_sensitive boolean NOT NULL DEFAULT false,
|
|
creator bigint NOT NULL DEFAULT 0, updater bigint NOT NULL DEFAULT 0,
|
|
created_at timestamptz NOT NULL DEFAULT NOW(), updated_at timestamptz NOT NULL DEFAULT NOW()
|
|
) ON COMMIT DROP`).Error; err != nil {
|
|
t.Fatalf("创建系统配置测试表失败:%v", err)
|
|
}
|
|
}
|