Repository navigation
v1.4.0
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 COLUMNdefinitions 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:
SqlFileParsernow parsesCOMMENT ON TABLEandCOMMENT ON COLUMNstatements from table SQL files and stores them in theTableSchema/ColumnDefinitionmodels.SchemaIntrospectoralso reads existing table and column comments from PostgreSQL, allowingSchemaDifferto detect comment changes correctly andDeployOrchestrator/SqlGeneratorto emit the correspondingCOMMENT 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
AddColumnchange is detected and the SQL definition includes a comment for that column, the deployer now emits a follow-upCOMMENT ON COLUMNstatement afterALTER 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, andSqlGeneratorTeststo 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