Skip to content

v1.1.0

Choose a tag to compare

@lawrence8358 lawrence8358 released this 18 Mar 09:54
· 28 commits to main since this release
eab5d4d

發布日期 (Release Date): 2026-03-18

主要亮點 (Highlights):

  • 新增 Connection String 支持,簡化 CI/CD 配置流程,密鑰管理更加安全
  • 新增自動建立資料庫功能,首次部署無需預先建立目標資料庫
  • 完全向後相容,現有部署流程無需任何改動

🌟 What's New / 主要更新

🚀 Features / 新功能

1. Connection String 支持(推薦用於 CI/CD)

  • 使用 --connection-string 或 -s 參數直接傳入完整連接字符串
  • 無需逐一指定 host、port、database、username、password 各參數
  • 特別適合 CI/CD 環境,配合密鑰管理系統使用

EN: Connection String Support - Use --connection-string (or -s alias) to pass a complete PostgreSQL connection string. Perfect for CI/CD pipelines with secret management systems.

使用範例 / Usage Example:

pgdeploy deploy \
  --config PostgresDeployer.json \
  --connection-string "Host=localhost;Database=mydb;Username=user;Password=secret" \
  --yes

2. 自動建立資料庫功能

  • 啟用 --create-db-if-not-exists 選項,部署時若目標資料庫不存在會自動建立
  • 支援配置檔案設定或命令列參數
  • 首次部署更方便,無需 DBA 預先建立空資料庫

EN: Auto-Create Database - Enable --create-db-if-not-exists to allow automatic database creation during deployment. No need to pre-create the database manually.

設定方法 / Configuration:

  • 配置檔案:"createDatabaseIfNotExists": true
  • 命令列:pgdeploy deploy --config PostgresDeployer.json --create-db-if-not-exists --yes

3. WPF 圖形介面新增設置選項

  • Settings 頁面新增「Auto-create database if it does not exist」複選框
  • Test Connection 按鈕可驗證伺服器連接狀態

EN: WPF Settings - GUI now offers "Auto-create database if it does not exist" option in Deploy Options.

🐛 Bug Fixes / 問題修復

  • Connection String 解析修復,確保配置優先級正確應用

    EN: Connection string parsing improvements for correct parameter precedence

  • WPF 連接測試改善,支援新的自動建立資料庫選項

    EN: WPF connection testing improved to support auto-create database option

⚠️ Breaking Changes / 重大變更

  • 無 (None) - 此版本完全向後相容,現有部署流程無需任何修改

    EN: None - Fully backward compatible with version 1.0.x


📝 使用指南 / Usage Guide

升級建議

  1. 如果您目前使用個別參數(如 --host、--port、--database),可繼續使用 ✅

    # 舊方法,仍然有效
    pgdeploy deploy \
      --config PostgresDeployer.json \
      --host localhost \
      --database mydb \
      --username user \
      --password secret \
      --yes
  2. 新版推薦:改用 Connection String(特別是 CI/CD 環境) 🚀

    # 新方法,更簡潔更安全
    pgdeploy deploy \
      --config PostgresDeployer.json \
      --connection-string "$DB_CONNSTR" \
      --yes

首次部署操作流程

如果是第一次部署到新環境,建議使用自動建立資料庫功能:

# 方法一:使用 Connection String + 自動建立資料庫
pgdeploy deploy \
  --config PostgresDeployer.json \
  --connection-string "Host=db.example.com;Database=newapp;Username=admin;Password=secret" \
  --create-db-if-not-exists \
  --yes

# 方法二:預先在配置檔案中啟用此選項
# 編輯 PostgresDeployer.json,在 options 中設定:
# "createDatabaseIfNotExists": true

❓ 常見問題 / FAQ

Q: 我應該使用 Connection String 還是個別參數?

A: 如果在 CI/CD 環境,強烈推薦使用 Connection String,可直接使用密鑰管理系統傳入。本地開發可繼續使用個別參數。

Q: 啟用自動建立資料庫需要什麼權限?

A: PostgreSQL 用戶需要 CREATEDB 權限。如無此權限,請聯繫資料庫管理員或預先手動建立資料庫。

Q: 這個版本與 1.0.x 相容嗎?

A: 完全相容。所有現有配置檔案和命令都能正常運作。新功能是完全可選的。


感謝使用 PostgresDeployer!如有任何問題,請參考 README
Thank you for using PostgresDeployer! For more information, see README