Skip to content

v1.4.0

Choose a tag to compare

@lawrence8358 lawrence8358 released this 03 Nov 01:29
· 15 commits to main since this release
01c26dd

Release v1.4.0

發布日期 (Date): 2026-06-03

主要亮點 (Highlights):

  • 新增資料表與欄位註解同步支援,現在部署工具會解析 SQL 定義中的 COMMENT ON TABLE / COMMENT ON COLUMN,並在差異比對與部署時正確更新 PostgreSQL 註解內容。
  • Added support for synchronizing table and column comments. The deployer now parses COMMENT ON TABLE / COMMENT ON COLUMN definitions from SQL files and applies comment changes during schema diffing and deployment.

🌟 What's New / 主要更新

🚀 Features / 新功能

  • 資料表與欄位註解同步支援:SqlFileParser 現在可從 Table SQL 檔中解析 COMMENT ON TABLE 與 COMMENT ON COLUMN,並將註解資訊納入 TableSchema / ColumnDefinition 模型。SchemaIntrospector 也會從 PostgreSQL 讀取現有的 table comment 與 column comment,讓 SchemaDiffer 可以在 SQL 定義與資料庫現況之間正確比對註解差異,並由 DeployOrchestrator / SqlGenerator 產生對應的 COMMENT ON ... 更新語句。

    EN: Table and column comment synchronization support: SqlFileParser now parses COMMENT ON TABLE and COMMENT ON COLUMN statements from table SQL files and stores them in the TableSchema / ColumnDefinition models. SchemaIntrospector also reads existing table and column comments from PostgreSQL, allowing SchemaDiffer to detect comment changes correctly and DeployOrchestrator / SqlGenerator to emit the corresponding COMMENT ON ... update statements.


🛠 Refactoring & Improvements / 重構與效能優化

  • 新增欄位時自動補上欄位註解:當部署流程偵測到 AddColumn 變更時,若 SQL 定義中該欄位同時包含 comment,系統會在 ALTER TABLE ... ADD COLUMN 後接續產生 COMMENT ON COLUMN,避免新增欄位成功但註解遺漏的情況。

    EN: Automatically apply column comments for newly added columns: When an AddColumn change is detected and the SQL definition includes a comment for that column, the deployer now emits a follow-up COMMENT ON COLUMN statement after ALTER TABLE ... ADD COLUMN, preventing newly added columns from missing their comments.

  • 補強註解同步測試覆蓋:新增 SqlFileParserTests、SchemaDifferTests 與 SqlGeneratorTests,涵蓋 comment 解析、註解差異偵測、SQL 產生與單引號跳脫等情境,降低後續回歸風險。

    EN: Expanded test coverage for comment synchronization: Added SqlFileParserTests, SchemaDifferTests, and SqlGeneratorTests to cover comment parsing, diff detection, SQL generation, and single-quote escaping scenarios, reducing regression risk in future changes.


🐛 Bug Fixes / 問題修復

  • 修正 Table 部署流程未同步 COMMENT 的問題:過去工具在處理既有資料表異動時,只會比對欄位型別、Nullable、Default、PK、Index、FK 等結構資訊,未將 table / column comment 納入變更分析,因此即使 SQL 定義檔已更新註解內容,部署後資料庫中的 comment 仍不會同步。現在 comment 已納入完整的 parse → introspect → diff → generate → deploy 流程。

    EN: Fixed missing COMMENT synchronization in table deployment: Previously, the deployment workflow compared structural changes such as column types, nullability, defaults, primary keys, indexes, and foreign keys, but ignored table and column comments. As a result, updated comments in SQL definition files were not propagated to the database. Comment metadata is now included throughout the full parse → introspect → diff → generate → deploy pipeline.


⚠️ Breaking Changes / 重大變更

無 / None