This commit is contained in:
vipg
2025-12-26 16:11:21 +08:00
parent e51805749a
commit 004a9e6bb5
2 changed files with 7 additions and 16 deletions

View File

@@ -26,7 +26,7 @@ docker run --rm \
-v "${PROJECT_ROOT}/infra/postgres/sql:/app/infra/postgres/sql" \
-w /app \
python:3.13.7-alpine3.22 \
bash -c "
sh -c "
echo '📋 容器内环境信息:'
python --version
echo ''

View File

@@ -1,12 +1,3 @@
-- =========================================================
-- table.sql (PostgreSQL 17.4+)
-- =========================================================
\pset pager off
\timing on
\c postgres;
CREATE EXTENSION IF NOT EXISTS "moddatetime" SCHEMA public;
DO $$
BEGIN
RAISE NOTICE '🚀============ 数据库表部署开始 ============🚀';
@@ -21,15 +12,15 @@ BEGIN
AND table_name = 'cn_futures_trading_records'
) THEN
CREATE TABLE cn_futures_trading_records (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY, -- id
payload JSONB NOT NULL, -- 数据
deleted BOOLEAN NOT NULL DEFAULT FALSE, -- 删除状态
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 记录创建时间
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP -- 记录修改时间
id UUID DEFAULT gen_random_uuid() PRIMARY KEY, -- id
payload JSONB NOT NULL, -- 数据
deleted BOOLEAN NOT NULL DEFAULT FALSE, -- 删除状态
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 记录创建时间
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP -- 记录修改时间
);
-- 3 触发器:自动刷新 updated_at
CREATE TRIGGER trg_cn_futures_trading_records_updated_at
CREATE TRIGGER trg_cn_futures_trading_records_at
BEFORE UPDATE ON cn_futures_trading_records
FOR EACH ROW
EXECUTE FUNCTION moddatetime(updated_at);