1.7 KiB
1.7 KiB
Schema Inventory Baseline
目的:提供之後做 DB 收斂、migration 對齊、fresh env 驗證時的最小入口。
何時閱讀
- 在修 ORM / migration drift 時
- 在新增資料表或欄位時
- 在排查「哪張表才是真正 source of truth」時
目前已確認的三類表
1. ORM + metadata 已納管
categoriesproductsprice_recordsmonthly_summary_analysisuserslogin_historypermissionsuser_permissionspromo_productstrend_recordstrend_keywordstrend_analysisweb_search_cachetelegram_usersai_generation_historyai_prompt_templatesai_usage_trackingai_insightsagent_contextaction_plansaction_outcomesagent_strategy_weightsincidentsplaybooksheal_logsimport_jobsimport_confignotification_templatesppt_reportsvendor_stockoutvendor_listvendor_emailsemail_send_logrealtime_sales_monthly
2. SQL migration / raw SQL 仍在用,但未見完整 ORM source of truth
ai_price_recommendationscompetitor_pricesembedding_retry_queuebackup_log
3. 目前最需要優先對齊的 drift
-
incidentsORM:traceback_str,matched_playbook_idmigration 013:error_traceback,playbook_id -
ai_insightsmigration 010 預設:avg_quality=0.5,status='approved'migration 015 預設:confidence=0.5,created_by='system'ORM 已在 2026-04-29 P1-1 對齊這組預設
下一步建議
- 為每張 live table 標記:
ORM-firstmigration-firstlegacy/raw-sql - 為 drift 最嚴重的表補正式 migration 修正腳本
- 建立 fresh env schema smoke test