feat: chat integration, tenant admin spec, backend chat service, miniprogram updates, DEMO moved to tmp, XCX-TEST removed, migrations & docs
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
-- 迁移:给 cfg_area_category 加 sort_order 字段 + 创建 app.v_cfg_area_category 视图
|
||||
-- 关联:R3 修复(项目类型筛选接口重建)
|
||||
-- 日期:2026-03-20
|
||||
-- 回滚:见文件末尾
|
||||
|
||||
-- ============================================================
|
||||
-- 1. 给 cfg_area_category 加 sort_order 字段
|
||||
-- ============================================================
|
||||
ALTER TABLE dws.cfg_area_category
|
||||
ADD COLUMN IF NOT EXISTS sort_order INTEGER DEFAULT 100 NOT NULL;
|
||||
|
||||
COMMENT ON COLUMN dws.cfg_area_category.sort_order
|
||||
IS '前端筛选器显示排序(值越小越靠前)';
|
||||
|
||||
-- 按业务优先级设置排序值
|
||||
UPDATE dws.cfg_area_category SET sort_order = 10 WHERE category_code = 'BILLIARD';
|
||||
UPDATE dws.cfg_area_category SET sort_order = 20 WHERE category_code = 'SNOOKER';
|
||||
UPDATE dws.cfg_area_category SET sort_order = 30 WHERE category_code = 'MAHJONG';
|
||||
UPDATE dws.cfg_area_category SET sort_order = 40 WHERE category_code = 'KTV';
|
||||
UPDATE dws.cfg_area_category SET sort_order = 900 WHERE category_code = 'SPECIAL';
|
||||
UPDATE dws.cfg_area_category SET sort_order = 999 WHERE category_code = 'OTHER';
|
||||
|
||||
-- ============================================================
|
||||
-- 2. 创建 app.v_cfg_area_category 视图
|
||||
-- 去重到 category 级别,排除 SPECIAL/OTHER(不在前端筛选器显示)
|
||||
-- ============================================================
|
||||
CREATE OR REPLACE VIEW app.v_cfg_area_category AS
|
||||
SELECT DISTINCT
|
||||
category_code,
|
||||
category_name,
|
||||
display_name,
|
||||
short_name,
|
||||
sort_order
|
||||
FROM dws.cfg_area_category
|
||||
WHERE is_active = TRUE
|
||||
AND category_code NOT IN ('SPECIAL', 'OTHER')
|
||||
ORDER BY sort_order;
|
||||
|
||||
GRANT SELECT ON app.v_cfg_area_category TO app_reader;
|
||||
|
||||
COMMENT ON VIEW app.v_cfg_area_category
|
||||
IS '项目类型筛选器配置视图(去重到 category 级别,排除 SPECIAL/OTHER)';
|
||||
|
||||
-- ============================================================
|
||||
-- 回滚
|
||||
-- ============================================================
|
||||
-- DROP VIEW IF EXISTS app.v_cfg_area_category;
|
||||
-- ALTER TABLE dws.cfg_area_category DROP COLUMN IF EXISTS sort_order;
|
||||
58
db/etl_feiqiu/migrations/2026-03-20_drop_recall_index.sql
Normal file
58
db/etl_feiqiu/migrations/2026-03-20_drop_recall_index.sql
Normal file
@@ -0,0 +1,58 @@
|
||||
-- =============================================================================
|
||||
-- 迁移:移除废弃的 dws_member_recall_index 表及 RLS 视图
|
||||
-- 日期: 2026-03-20
|
||||
-- 原因: RecallIndexTask 已于 2026-02-13 被 WBI+NCI 替代,但表和视图的 DDL
|
||||
-- 在 2026-02-19 schema 重命名(billiards_dws → dws)时残留至今。
|
||||
-- 表中无有效数据(ETL 任务已删除),属于孤儿对象。
|
||||
-- 影响: 无下游消费者依赖此表数据(后端 recall 维度已改用 v_dws_member_winback_index)
|
||||
-- 回滚: 从 git 历史恢复 DDL 定义并重建表和视图
|
||||
-- =============================================================================
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- 1. 删除 RLS 视图
|
||||
DROP VIEW IF EXISTS app.v_dws_member_recall_index;
|
||||
|
||||
-- 2. 删除索引
|
||||
DROP INDEX IF EXISTS dws.idx_dws_recall_display;
|
||||
|
||||
-- 3. 删除表(CASCADE 会自动清理约束)
|
||||
DROP TABLE IF EXISTS dws.dws_member_recall_index CASCADE;
|
||||
|
||||
-- 4. 删除序列
|
||||
DROP SEQUENCE IF EXISTS dws.dws_member_recall_index_recall_id_seq;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- =============================================================================
|
||||
-- 验证
|
||||
-- =============================================================================
|
||||
DO $$
|
||||
DECLARE
|
||||
tbl_exists BOOLEAN;
|
||||
view_exists BOOLEAN;
|
||||
seq_exists BOOLEAN;
|
||||
BEGIN
|
||||
SELECT EXISTS(
|
||||
SELECT 1 FROM information_schema.tables
|
||||
WHERE table_schema = 'dws' AND table_name = 'dws_member_recall_index'
|
||||
) INTO tbl_exists;
|
||||
|
||||
SELECT EXISTS(
|
||||
SELECT 1 FROM information_schema.views
|
||||
WHERE table_schema = 'app' AND table_name = 'v_dws_member_recall_index'
|
||||
) INTO view_exists;
|
||||
|
||||
SELECT EXISTS(
|
||||
SELECT 1 FROM information_schema.sequences
|
||||
WHERE sequence_schema = 'dws' AND sequence_name = 'dws_member_recall_index_recall_id_seq'
|
||||
) INTO seq_exists;
|
||||
|
||||
RAISE NOTICE '表存在: % (应为 false)', tbl_exists;
|
||||
RAISE NOTICE '视图存在: % (应为 false)', view_exists;
|
||||
RAISE NOTICE '序列存在: % (应为 false)', seq_exists;
|
||||
|
||||
IF tbl_exists OR view_exists OR seq_exists THEN
|
||||
RAISE EXCEPTION '清理不完整,仍有残留对象';
|
||||
END IF;
|
||||
END $$;
|
||||
Reference in New Issue
Block a user