# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: PostgreSQL
spec:
    description: A free and open-source relational database management system emphasizing extensibility and SQL compliance.
    coverImage: https://kinsta.com/wp-content/uploads/2022/03/what-is-postgresql.png
    icon: https://cdn.zeabur.com/marketplace/postgresql.svg
    tags:
        - Database
    readme: "# Deploying PostgreSQL\n\n**PostgreSQL** (often referred to as Postgres) is a powerful, open-source object-relational database system. It is widely admired for its reliability, robust feature set, and adherence to SQL standards. It is the go-to choice for applications requiring complex queries, ACID compliance, and strict data integrity.\n\nZeabur makes managing relational databases effortless. With Zeabur, you can launch a production-ready PostgreSQL instance in seconds without dealing with complex configuration files, storage volumes, or server maintenance.\n\n### What you will learn\n\nIn this tutorial, we will guide you through:\n\n1. Deploying a PostgreSQL service from the Zeabur Marketplace.\n2. Connecting to your database using external tools like **TablePlus**, **pgAdmin**, or **psql**.\n3. Connecting your deployed backend application to PostgreSQL.\n\n---\n\n## Phase 1: Deploying the Database\n\n### Step 1: Create the PostgreSQL Service\n\nZeabur offers a \"one-click deployment\", meaning you rarely need to configure complex settings manually.\n\n**Option 1: Create Postgresql instance from Project page**\n\n1. Log in to your [**Zeabur Dashboard**](https://zeabur.com/).\n2. Click the **\"New Project\"** button.\n3. Select **\"Template\"** (Marketplace).\n4. Search for `PostgreSQL`.\n5. Select the official **PostgreSQL** image. Your service will start deploying immediately.\n\n**Option 2: Create Postgresql instance from template page**\n\n1. Log in to your [**Zeabur Dashboard**](https://zeabur.com/).\n2. Select `Features` and `Template`.\n3. Choose or Search `PostgreSQL`.\n4. Select `PostgreSQL` (usually the official image) click `deploy` and it will start deploying.\n\n### Step 2: Get Your Connection Credentials\n\n1. Go to the **Instruction** tab of your service.\n2. Look for the **\"Connection\"** section. You will see two types of info:\n    - **Public (External):** Used for VS Code / Local App.\n    - **Private (Internal):** Used for your deployed App.\n3. Note down the following details from the **Public** section:\n    - **Host:** (e.g., `postgres.zeabur.app`)\n    - **Port:** (Usually `5432` or a randomized port)\n    - **Username:** (Default is usually `root` or `postgres`)\n    - **Password:** (Click the \"Eye\" icon to reveal)\n    - **Database:** (Default is `postgres`)\n\n---\n\n## Phase 2: Connecting with database\n\n### Prerequisite: Get Your Public Connection Info\n\nBefore you open any tool, ensure you have your connection details ready from the Zeabur Dashboard.\n\n1. Go to your PostgreSQL Service in Zeabur.\n2. Click the **Instruction** tab.\n3. Look at the **\"Public\"** (External) section. You will get:\n    - **Connection String**\n    - **PostgreSQL Connect Command**\n    - **PostgreSQL username**\n    - **PostgresSQL password**\n    - **PostgresSQL database**\n    - **PostgreSQL host**\n    - **PostgreSQL port**\n\n---\n\n### Option 1: Connect using VS Code (SQLTools)\n\n*Best for: Developers who want to write code and check the database in the same window.*\n\n**Step 1: Install Extensions**\n\n1. Open VS Code or Any VS Code alternatives.\n2. Click the **Extensions** icon in the left sidebar (`Ctrl+Shift+X` or `Cmd+Shift+X`).\n3. Search for and install: **SQLTools.**\n4. Search for and install the driver: **SQLTools PostgreSQL/Cockroach Driver**.\n\n**Step 2: Create Connection**\n\n1. Click the **SQLTools icon** (a database cylinder) that appeared in your left sidebar.\n2. Hover over \"Connections\" and click the **\"Add New Connection\"** icon (a cylinder with a `+`).\n3. Select **PostgreSQL**.\n\n**Step 3: Configure Settings**\nFill in the form using your Zeabur details:\n\n- **Connection Name:** `Zeabur DB` (or any name you like)\n- **Connect using:** `Server and Port`\n- **Server Address (Host):** Paste your **Postgresql** **Host**.\n- **Port:** Paste your **Postgresql** **Port**.\n- **Database:** Paste your **Postgresql** **Database** (usually `postgres`).\n- **Username:** Paste your **Postgresql** **User**.\n- **Password:** Paste your **Postgresql** **Password**.\n- **SSL:** Leave as default (or select \"Require\" if connection fails).\n\n**Step 4: Test and Connect**\n\n1. Click **\"Test Connection\"** at the bottom. You should see a green \"Successfully Connected\" message.\n2. Click **\"Save Connection\"**.\n3. In the sidebar, right-click your new connection and select **\"Connect\"**.\n4. You can now expand the tree view to see your **Tables**, **Views**, and **Functions**.\n\n---\n\n### Option 2: Connect using pgAdmin 4 (Official GUI)\n\n*Best for: Comprehensive database management using the standard, open-source interface used by database administrators.*\n\n**Step 1: Install pgAdmin**\n\n1. Download and install [**pgAdmin 4**](https://www.pgadmin.org/download/) for your OS (Windows, macOS, or Linux).\n2. Open pgAdmin 4. (Note: It may open in your web browser, which is normal).\n\n**Step 2: Register Server**\n\n1. In the left sidebar (Browser tree), right-click on **Servers**.\n2. Select **Register** > **Server...**\n\n**Step 3: Enter Credentials**\nA pop-up window will appear. You need to fill in two tabs:\n\n- **Tab 1: General**\n    - **Name:** Enter a name for your project (e.g., `Zeabur App DB`).\n- **Tab 2: Connection**\n    - **Host name/address:** Paste your **Postgresql** **Host** (e.g., `xxxx.clusters.zeabur.com`).\n    - **Port:** Paste your **Postgresql** **Port**.\n    - **Maintenance database:** Paste your **Postgresql** **Database** (usually `postgres`).\n    - **Username:** Paste your **Postgresql** **User** (usually `root`).\n    - **Password:** Paste your **Postgresql** **Password**.\n    - *Optional:* Click \"Save Password\" to avoid typing it every time.\n- **Tab 3: Parameters (Optional)**\n    - If you encounter SSL errors, go to the **SSL** tab and set \"SSL mode\" to `Require` or `Prefer`.\n\n**Step 4: Connect**\n\n1. Click the blue **Save** button.\n2. Your database will appear in the sidebar list.\n3. Click the arrow `>` next to your server name > **Databases** > **postgres** > **Schemas** > **public** > **Tables** to view your data.\n\n---\n\n## Phase 3: Connecting Your App (Inter-Service)\n\nWhen you deploy your application (the one you made in AI Studio/GitHub) to Zeabur, it needs to talk to this database. You should use **Private Networking** for better security and speed.\n\n### Method A: The Easy Way (Environment Variables)\n\nZeabur automatically exposes connection strings to other services in the same project. In your App Service settings:\n\n1. Go to the **Variables** tab.\n2. Add a new variable named `DATABASE_URL` (or whatever your code uses).\n3. For the value, use the Zeabur reference variable:*This automatically pulls the secure, internal connection string.*\n    \n    ```bash\n    ${POSTGRES_CONNECTION_STRING}\n    \n    ```\n    \n\n### Method B: The Manual Way (Specific Variables)\n\nIf you need specific parts of the connection (or have multiple DBs), use these variables:\n\n- **Host:** `${POSTGRES_HOST}` (Your DB hostname, usually ending in `.zeabur.internal`)\n- **Port:** `${POSTGRES_PORT}`\n- **User:** `${POSTGRES_USERNAME}`\n- **Password:** `${POSTGRES_PASSWORD}`\n\n> Note: If your project contains multiple PostgreSQL instances, reference variables might be unreliable. In that case, manually copy the \"Internal\" Hostname and Port from the Networking tab.\n> \n\n---\n\n## Phase 4: Maintenance & Backups\n\n### Configuration (Advanced)\n\nIf you need to tweak specific database settings (like memory limits or logging):\n\n1. Open the **Config Editor** in Zeabur.\n2. Edit the file `/etc/postgresql/postgresql.conf`.\n3. *Note: Zeabur pre-configures essential settings, so this is rarely needed for beginners.*\n\n### Restoring a Backup\n\nZeabur performs automatic backups. To restore one:\n\n1. **Download:** Download and extract the backup file from Zeabur's backup storage. You will get a `data.sql` file.\n2. **Prepare:** Ensure you have PostgreSQL client tools installed on your local machine.\n3. **Run Command:** Find your **\"PostgreSQL Connect Command\"** in the Instructions tab and run this in your terminal:*Example:* `psql -h postgres.zeabur.app -p 5432 -U root postgres < data.sql`\n    \n    ```bash\n    <Your PostgreSQL Connect Command> < data.sql\n    \n    ```\n    \n\n> Warning: Restoring a backup replaces the existing data and user password. If you want to keep the current password, remove the CREATE ROLE and ALTER ROLE statements from the data.sql file before running the command.\n>\n"
    services:
        - name: postgresql
          icon: https://cdn.zeabur.com/marketplace/postgresql.svg
          template: PREBUILT
          spec:
            id: postgresql
            source:
                image: postgres:18
                command:
                    - docker-entrypoint.sh
                    - -c
                    - config_file=/etc/postgresql/postgresql.conf
            ports:
                - id: database
                  port: 5432
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/postgresql/18/docker
            instructions:
                - title: Connection String
                  content: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}
                - title: PostgreSQL Connect Command
                  content: psql "postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}"
                - title: PostgreSQL username
                  content: ${POSTGRES_USERNAME}
                - title: PostgresSQL password
                  content: ${POSTGRES_PASSWORD}
                - title: PostgresSQL database
                  content: ${POSTGRES_DATABASE}
                - title: PostgreSQL host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: PostgreSQL port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
            env:
                PGDATA:
                    default: /var/lib/postgresql/18/docker/pgdata
                    expose: false
                POSTGRES_CONNECTION_STRING:
                    default: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}
                    expose: true
                POSTGRES_DATABASE:
                    default: ${POSTGRES_DB}
                    expose: true
                POSTGRES_DB:
                    default: zeabur
                POSTGRES_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                POSTGRES_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                POSTGRES_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                POSTGRES_URI:
                    default: ${POSTGRES_CONNECTION_STRING}
                    expose: true
                POSTGRES_USER:
                    default: root
                POSTGRES_USERNAME:
                    default: ${POSTGRES_USER}
                    expose: true
            configs:
                - path: /etc/postgresql/postgresql.conf
                  template: |
                    # https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample
                    listen_addresses = '*'
                    max_connections = 256
                    shared_buffers = 256MB
                    dynamic_shared_memory_type = posix
                    max_wal_size = 1GB
                    min_wal_size = 80MB
                    log_timezone = 'UTC'
                    datestyle = 'iso, mdy'
                    timezone = 'UTC'
                    lc_messages = 'en_US.UTF-8'
                    lc_monetary = 'en_US.UTF-8'
                    lc_numeric = 'en_US.UTF-8'
                    lc_time = 'en_US.UTF-8'
                    default_text_search_config = 'pg_catalog.english'
                  permission: null
                  envsubst: null
localization:
    es-ES:
        description: Un potente sistema de base de datos objeto-relacional de código abierto, conocido por su fiabilidad, integridad de datos y cumplimiento de SQL.
        readme: "# Desplegar PostgreSQL\n\n**PostgreSQL** (a menudo llamado Postgres) es un potente sistema de base de datos objeto-relacional de código abierto. Es ampliamente admirado por su fiabilidad, su robusto conjunto de funciones y su adhesión a los estándares SQL. Es una opción ideal para aplicaciones que requieren consultas complejas, cumplimiento ACID y una estricta integridad de datos.\n\nZeabur hace que la gestión de bases de datos relacionales sea sencilla. Con Zeabur, puedes lanzar una instancia de PostgreSQL lista para producción en segundos, sin tener que lidiar con archivos de configuración complejos, volúmenes de almacenamiento o mantenimiento de servidores.\n\n### Lo que aprenderás\n\nEn este tutorial te guiaremos a través de:\n\n1. Desplegar un servicio de PostgreSQL desde el Marketplace de Zeabur.\n2. Conectarte a tu base de datos usando herramientas externas como **TablePlus**, **pgAdmin** o **psql**.\n3. Conectar tu aplicación backend desplegada a PostgreSQL.\n\n---\n\n## Fase 1: Desplegar la base de datos\n\n### Paso 1: Crear el servicio de PostgreSQL\n\nZeabur ofrece un “despliegue con un clic”, lo que significa que rara vez necesitas configurar ajustes complejos manualmente.\n\n**Opción 1: Crear una instancia de PostgreSQL desde la página del proyecto**\n\n1. Inicia sesión en tu [**Zeabur Dashboard**](https://zeabur.com/).\n2. Haz clic en el botón **\"New Project\"**.\n3. Selecciona **\"Template\"** (Marketplace).\n4. Busca `PostgreSQL`.\n5. Selecciona la imagen oficial de **PostgreSQL**. Tu servicio comenzará a desplegarse inmediatamente.\n\n**Opción 2: Crear una instancia de PostgreSQL desde la página de la plantilla**\n\n1. Inicia sesión en tu [**Zeabur Dashboard**](https://zeabur.com/).\n2. Selecciona `Features` y `Template`.\n3. Elige o busca `PostgreSQL`.\n4. Selecciona `PostgreSQL` (normalmente la imagen oficial), haz clic en `deploy` y comenzará el despliegue.\n\n### Paso 2: Obtener tus credenciales de conexión\n\n1. Ve a la pestaña **Instruction** de tu servicio.\n2. Busca la sección **\"Connection\"**. Verás dos tipos de información:\n    - **Public (External):** Para VS Code / app local.\n    - **Private (Internal):** Para tu app desplegada.\n3. Anota los siguientes datos de la sección **Public**:\n    - **Host:** (por ejemplo, `postgres.zeabur.app`)\n    - **Port:** (normalmente `5432` o un puerto aleatorio)\n    - **Username:** (por defecto suele ser `root` o `postgres`)\n    - **Password:** (haz clic en el icono del “ojo” para mostrarla)\n    - **Database:** (por defecto es `postgres`)\n\n---\n\n## Fase 2: Conectarte a la base de datos\n\n### Requisito previo: obtener la información pública de conexión\n\nAntes de abrir cualquier herramienta, asegúrate de tener listos los detalles de conexión desde el Zeabur Dashboard.\n\n1. Ve a tu servicio de PostgreSQL en Zeabur.\n2. Haz clic en la pestaña **Instruction**.\n3. En la sección **\"Public\"** (External) verás:\n    - **Connection String**\n    - **PostgreSQL Connect Command**\n    - **PostgreSQL username**\n    - **PostgresSQL password**\n    - **PostgresSQL database**\n    - **PostgreSQL host**\n    - **PostgreSQL port**\n\n---\n\n### Opción 1: Conectar usando VS Code (SQLTools)\n\n*Ideal para: desarrolladores que quieren escribir código y revisar la base de datos en la misma ventana.*\n\n**Paso 1: Instalar extensiones**\n\n1. Abre VS Code o cualquier alternativa compatible.\n2. Haz clic en **Extensions** (`Ctrl+Shift+X` o `Cmd+Shift+X`).\n3. Busca e instala: **SQLTools**.\n4. Busca e instala el driver: **SQLTools PostgreSQL/Cockroach Driver**.\n\n**Paso 2: Crear la conexión**\n\n1. Haz clic en el icono de **SQLTools** (cilindro de base de datos) en la barra lateral izquierda.\n2. Pasa el cursor sobre “Connections” y haz clic en **\"Add New Connection\"** (un cilindro con `+`).\n3. Selecciona **PostgreSQL**.\n\n**Paso 3: Configurar los parámetros**\nCompleta el formulario con tus datos de Zeabur:\n\n- **Connection Name:** `Zeabur DB` (o el nombre que quieras)\n- **Connect using:** `Server and Port`\n- **Server Address (Host):** pega tu **Postgresql** **Host**\n- **Port:** pega tu **Postgresql** **Port**\n- **Database:** pega tu **Postgresql** **Database** (normalmente `postgres`)\n- **Username:** pega tu **Postgresql** **User**\n- **Password:** pega tu **Postgresql** **Password**\n- **SSL:** deja el valor por defecto (o selecciona \"Require\" si falla)\n\n**Paso 4: Probar y conectar**\n\n1. Haz clic en **\"Test Connection\"**. Deberías ver “Successfully Connected”.\n2. Haz clic en **\"Save Connection\"**.\n3. En la barra lateral, haz clic derecho en tu conexión y selecciona **\"Connect\"**.\n4. Ya puedes expandir el árbol para ver **Tables**, **Views** y **Functions**.\n\n---\n\n### Opción 2: Conectar usando pgAdmin 4 (GUI oficial)\n\n*Ideal para: administración completa de bases de datos usando la interfaz estándar de código abierto.*\n\n**Paso 1: Instalar pgAdmin**\n\n1. Descarga e instala [**pgAdmin 4**](https://www.pgadmin.org/download/) para tu sistema operativo.\n2. Abre pgAdmin 4. (Nota: es normal que se abra en el navegador).\n\n**Paso 2: Registrar el servidor**\n\n1. En el panel izquierdo, haz clic derecho en **Servers**.\n2. Selecciona **Register** > **Server...**\n\n**Paso 3: Introducir credenciales**\nAparecerá una ventana emergente. Debes completar estas pestañas:\n\n- **Pestaña 1: General**\n    - **Name:** escribe un nombre (por ejemplo, `Zeabur App DB`)\n- **Pestaña 2: Connection**\n    - **Host name/address:** pega tu **Postgresql** **Host**\n    - **Port:** pega tu **Postgresql** **Port**\n    - **Maintenance database:** pega tu **Postgresql** **Database** (normalmente `postgres`)\n    - **Username:** pega tu **Postgresql** **User** (normalmente `root`)\n    - **Password:** pega tu **Postgresql** **Password**\n    - *Opcional:* marca “Save Password” para no escribirla cada vez\n- **Pestaña 3: Parameters (opcional)**\n    - Si hay errores SSL, ve a la pestaña **SSL** y ajusta “SSL mode” a `Require` o `Prefer`.\n\n**Paso 4: Conectar**\n\n1. Haz clic en el botón azul **Save**.\n2. Tu base de datos aparecerá en la barra lateral.\n3. Abre `>` junto a tu servidor > **Databases** > **postgres** > **Schemas** > **public** > **Tables**.\n\n---\n\n## Fase 3: Conectar tu app (inter-servicio)\n\nCuando despliegas tu aplicación a Zeabur, necesita comunicarse con esta base de datos. Para mayor seguridad y rendimiento, usa **Private Networking**.\n\n### Método A: La forma fácil (variables de entorno)\n\nZeabur expone automáticamente cadenas de conexión a otros servicios del mismo proyecto. En tu servicio de app:\n\n1. Ve a la pestaña **Variables**.\n2. Añade una variable llamada `DATABASE_URL` (o el nombre que use tu código).\n3. En el valor, usa la variable de referencia de Zeabur: *esto insertará automáticamente la cadena interna y segura*.\n    \n    ```bash\n    ${POSTGRES_CONNECTION_STRING}\n    \n    ```\n    \n\n### Método B: La forma manual (variables específicas)\n\nSi necesitas partes específicas de la conexión (o tienes varias bases de datos), usa:\n\n- **Host:** `${POSTGRES_HOST}` (hostname interno, suele terminar en `.zeabur.internal`)\n- **Port:** `${POSTGRES_PORT}`\n- **User:** `${POSTGRES_USERNAME}`\n- **Password:** `${POSTGRES_PASSWORD}`\n\n> Nota: si tu proyecto tiene varias instancias de PostgreSQL, las variables de referencia podrían apuntar a otra instancia. En ese caso, copia manualmente el hostname y el puerto internos desde la pestaña Networking.\n>\n\n---\n\n## Fase 4: Mantenimiento y copias de seguridad\n\n### Configuración (avanzado)\n\nSi necesitas ajustar configuraciones (memoria, logs, etc.):\n\n1. Abre el **Config Editor** en Zeabur.\n2. Edita el archivo `/etc/postgresql/postgresql.conf`.\n3. *Nota: Zeabur ya preconfigura ajustes esenciales, así que normalmente no es necesario.*\n\n### Restaurar una copia de seguridad\n\nZeabur realiza backups automáticos. Para restaurar uno:\n\n1. **Descargar:** descarga y extrae el archivo de backup desde el almacenamiento de Zeabur. Obtendrás un `data.sql`.\n2. **Preparar:** asegúrate de tener instaladas las herramientas cliente de PostgreSQL.\n3. **Ejecutar:** busca tu **\"PostgreSQL Connect Command\"** en la pestaña Instructions y ejecútalo en tu terminal. *Ejemplo:* `psql -h postgres.zeabur.app -p 5432 -U root postgres < data.sql`\n    \n    ```bash\n    <Your PostgreSQL Connect Command> < data.sql\n    \n    ```\n    \n\n> Advertencia: restaurar un backup reemplaza los datos existentes y la contraseña del usuario. Si quieres conservar la contraseña actual, elimina las sentencias CREATE ROLE y ALTER ROLE del archivo `data.sql` antes de ejecutar el comando.\n>\n"
    ja-JP:
        description: 信頼性と豊富な機能、SQL 準拠で評価される、強力なオープンソースのオブジェクトリレーショナルデータベースです。
        readme: "# PostgreSQL のデプロイ\n\n**PostgreSQL**（Postgres とも呼ばれます）は、強力なオープンソースのオブジェクトリレーショナルデータベースです。高い信頼性、堅牢な機能セット、SQL 標準への準拠で広く支持されています。複雑なクエリ、ACID 準拠、厳密なデータ整合性が求められるアプリケーションに最適です。\n\nZeabur なら、リレーショナルデータベースの運用がとても簡単です。複雑な設定ファイル、ストレージボリューム、サーバーメンテナンスに悩むことなく、数秒で本番向けの PostgreSQL インスタンスを起動できます。\n\n### このチュートリアルで学べること\n\nこのチュートリアルでは、次の内容を案内します：\n\n1. Zeabur Marketplace から PostgreSQL サービスをデプロイする\n2. **TablePlus**、**pgAdmin**、**psql** などの外部ツールから接続する\n3. デプロイ済みのバックエンドアプリを PostgreSQL に接続する\n\n---\n\n## フェーズ 1: データベースのデプロイ\n\n### ステップ 1: PostgreSQL サービスを作成\n\nZeabur は「ワンクリックデプロイ」を提供しているため、複雑な設定を手動で行う必要はほとんどありません。\n\n**オプション 1: プロジェクトページから PostgreSQL インスタンスを作成**\n\n1. [**Zeabur Dashboard**](https://zeabur.com/) にログインします。\n2. **\"New Project\"** をクリックします。\n3. **\"Template\"**（Marketplace）を選択します。\n4. `PostgreSQL` を検索します。\n5. 公式の **PostgreSQL** イメージを選択します。すぐにデプロイが開始されます。\n\n**オプション 2: テンプレートページから PostgreSQL インスタンスを作成**\n\n1. [**Zeabur Dashboard**](https://zeabur.com/) にログインします。\n2. `Features` と `Template` を選択します。\n3. `PostgreSQL` を選ぶか検索します。\n4. `PostgreSQL`（通常は公式イメージ）を選び、`deploy` をクリックするとデプロイが開始されます。\n\n### ステップ 2: 接続情報を確認\n\n1. サービスの **Instruction** タブを開きます。\n2. **\"Connection\"** セクションを探します。次の 2 種類の情報が表示されます：\n    - **Public (External):** VS Code / ローカルアプリ向け\n    - **Private (Internal):** デプロイ済みアプリ向け\n3. **Public** セクションから次の項目を控えます：\n    - **Host:**（例：`postgres.zeabur.app`）\n    - **Port:**（通常 `5432` またはランダムなポート）\n    - **Username:**（デフォルトは `root` または `postgres` が一般的）\n    - **Password:**（「目」アイコンで表示）\n    - **Database:**（デフォルトは `postgres`）\n\n---\n\n## フェーズ 2: データベースに接続\n\n### 事前準備: Public の接続情報を用意\n\nツールを開く前に、Zeabur Dashboard で接続情報を確認しておきます。\n\n1. Zeabur 上の PostgreSQL サービスを開きます。\n2. **Instruction** タブをクリックします。\n3. **\"Public\"**（External）セクションに次が表示されます：\n    - **Connection String**\n    - **PostgreSQL Connect Command**\n    - **PostgreSQL username**\n    - **PostgresSQL password**\n    - **PostgresSQL database**\n    - **PostgreSQL host**\n    - **PostgreSQL port**\n\n---\n\n### オプション 1: VS Code（SQLTools）で接続\n\n*おすすめ: コードと DB を同じ画面で扱いたい開発者向け。*\n\n**ステップ 1: 拡張機能をインストール**\n\n1. VS Code（または互換のエディタ）を開きます。\n2. 左サイドバーの **Extensions**（`Ctrl+Shift+X` / `Cmd+Shift+X`）を開きます。\n3. **SQLTools** を検索してインストールします。\n4. **SQLTools PostgreSQL/Cockroach Driver** を検索してインストールします。\n\n**ステップ 2: 接続を作成**\n\n1. 左サイドバーの **SQLTools** アイコン（DB の цилиндr アイコン）をクリックします。\n2. “Connections” にカーソルを合わせ、**\"Add New Connection\"**（`+` 付きアイコン）をクリックします。\n3. **PostgreSQL** を選択します。\n\n**ステップ 3: 設定を入力**\nZeabur の情報でフォームを埋めます：\n\n- **Connection Name:** `Zeabur DB`（任意）\n- **Connect using:** `Server and Port`\n- **Server Address (Host):** **Postgresql** **Host** を貼り付け\n- **Port:** **Postgresql** **Port** を貼り付け\n- **Database:** **Postgresql** **Database**（通常 `postgres`）\n- **Username:** **Postgresql** **User**\n- **Password:** **Postgresql** **Password**\n- **SSL:** 既定のまま（失敗する場合は \"Require\"）\n\n**ステップ 4: テストして接続**\n\n1. **\"Test Connection\"** をクリックし、成功メッセージを確認します。\n2. **\"Save Connection\"** をクリックします。\n3. サイドバーで接続を右クリックし **\"Connect\"** を選びます。\n4. ツリーで **Tables** / **Views** / **Functions** を確認できます。\n\n---\n\n### オプション 2: pgAdmin 4（公式 GUI）で接続\n\n*おすすめ: DB 管理者向けの標準 GUI を使って管理したい場合。*\n\n**ステップ 1: pgAdmin をインストール**\n\n1. [**pgAdmin 4**](https://www.pgadmin.org/download/) を OS に合わせてダウンロードしてインストールします。\n2. pgAdmin 4 を起動します。（ブラウザで開くのは正常です）\n\n**ステップ 2: サーバーを登録**\n\n1. 左のツリーで **Servers** を右クリックします。\n2. **Register** > **Server...** を選択します。\n\n**ステップ 3: 接続情報を入力**\nポップアップで次のタブを入力します：\n\n- **タブ 1: General**\n    - **Name:** 任意（例：`Zeabur App DB`）\n- **タブ 2: Connection**\n    - **Host name/address:** **Postgresql** **Host**\n    - **Port:** **Postgresql** **Port**\n    - **Maintenance database:** **Postgresql** **Database**（通常 `postgres`）\n    - **Username:** **Postgresql** **User**（通常 `root`）\n    - **Password:** **Postgresql** **Password**\n    - *任意:* “Save Password” を有効化\n- **タブ 3: Parameters（任意）**\n    - SSL エラーの場合、**SSL** タブで “SSL mode” を `Require` または `Prefer` にします。\n\n**ステップ 4: 接続**\n\n1. 青い **Save** ボタンをクリックします。\n2. 左のツリーに DB が追加されます。\n3. `>` で展開し、**Databases** > **postgres** > **Schemas** > **public** > **Tables** でデータを確認します。\n\n---\n\n## フェーズ 3: アプリ（サービス間）接続\n\nアプリを Zeabur にデプロイすると、DB と通信する必要があります。セキュリティと速度のため、**Private Networking** を推奨します。\n\n### 方法 A: 簡単（環境変数）\n\nZeabur は同一プロジェクト内のサービス間で接続文字列を自動的に公開できます。アプリ側の設定で：\n\n1. **Variables** タブを開きます。\n2. `DATABASE_URL`（またはコードで使用する名前）を追加します。\n3. 値に Zeabur の参照変数を設定します（内部用の安全な接続文字列が自動で入ります）。\n    \n    ```bash\n    ${POSTGRES_CONNECTION_STRING}\n    \n    ```\n    \n\n### 方法 B: 手動（個別変数）\n\n接続情報の一部だけが必要な場合（または DB が複数ある場合）は次を使います：\n\n- **Host:** `${POSTGRES_HOST}`（通常 `.zeabur.internal` で終わる内部ホスト名）\n- **Port:** `${POSTGRES_PORT}`\n- **User:** `${POSTGRES_USERNAME}`\n- **Password:** `${POSTGRES_PASSWORD}`\n\n> 注意: PostgreSQL インスタンスが複数ある場合、参照変数が別インスタンスを指すことがあります。その場合は Networking タブから Internal の Hostname/Port を手動で指定してください。\n>\n\n---\n\n## フェーズ 4: 運用・バックアップ\n\n### 設定（上級）\n\nメモリやログなどを調整したい場合：\n\n1. Zeabur の **Config Editor** を開きます。\n2. `/etc/postgresql/postgresql.conf` を編集します。\n3. *注意: 重要な設定は事前に調整済みのため、多くの場合は不要です。*\n\n### バックアップの復元\n\nZeabur は自動バックアップを行います。復元するには：\n\n1. **ダウンロード:** バックアップストレージからバックアップをダウンロードして展開します。`data.sql` が得られます。\n2. **準備:** ローカルに PostgreSQL クライアントツールがインストールされていることを確認します。\n3. **実行:** Instructions の **\"PostgreSQL Connect Command\"** を探し、ターミナルで実行します。*例:* `psql -h postgres.zeabur.app -p 5432 -U root postgres < data.sql`\n    \n    ```bash\n    <Your PostgreSQL Connect Command> < data.sql\n    \n    ```\n    \n\n> 警告: 復元すると既存データとユーザーパスワードが置き換わります。現在のパスワードを維持したい場合は、実行前に `data.sql` から CREATE ROLE と ALTER ROLE の文を削除してください。\n>\n"
    zh-CN:
        description: 强大、可靠的开源对象关系型数据库，具备丰富功能、ACID 合规与严格的数据完整性。
        readme: "# 部署 PostgreSQL\n\n**PostgreSQL**（常称 Postgres）是强大的开源对象关系型数据库系统，以可靠性、丰富功能以及对 SQL 标准的遵循而广受好评。它非常适合需要复杂查询、ACID 合规以及严格数据完整性的应用场景。\n\nZeabur 让关系型数据库的管理变得轻松。通过 Zeabur，你可以在几秒钟内启动一个可用于生产环境的 PostgreSQL 实例，无需处理复杂的配置文件、存储卷或服务器维护。\n\n### 你将学到什么\n\n在本教程中，我们将带你完成：\n\n1. 从 Zeabur Marketplace 部署 PostgreSQL 服务\n2. 使用 **TablePlus**、**pgAdmin** 或 **psql** 等外部工具连接数据库\n3. 将已部署的后端应用连接到 PostgreSQL\n\n---\n\n## 阶段 1：部署数据库\n\n### 步骤 1：创建 PostgreSQL 服务\n\nZeabur 提供“一键部署”，因此你很少需要手动配置复杂参数。\n\n**选项 1：从项目页面创建 PostgreSQL 实例**\n\n1. 登录 [**Zeabur Dashboard**](https://zeabur.com/)。\n2. 点击 **\"New Project\"**。\n3. 选择 **\"Template\"**（Marketplace）。\n4. 搜索 `PostgreSQL`。\n5. 选择官方 **PostgreSQL** 镜像，服务会立即开始部署。\n\n**选项 2：从模板页面创建 PostgreSQL 实例**\n\n1. 登录 [**Zeabur Dashboard**](https://zeabur.com/)。\n2. 选择 `Features` 与 `Template`。\n3. 选择或搜索 `PostgreSQL`。\n4. 选择 `PostgreSQL`（通常是官方镜像），点击 `deploy` 开始部署。\n\n### 步骤 2：获取连接凭据\n\n1. 进入服务的 **Instruction** 标签页。\n2. 找到 **\"Connection\"** 区域，你会看到两类信息：\n    - **Public (External)：** 用于 VS Code / 本地应用\n    - **Private (Internal)：** 用于已部署的应用\n3. 从 **Public** 区域记录以下信息：\n    - **Host：**（例如 `postgres.zeabur.app`）\n    - **Port：**（通常是 `5432` 或随机端口）\n    - **Username：**（默认通常是 `root` 或 `postgres`）\n    - **Password：**（点击“眼睛”图标显示）\n    - **Database：**（默认是 `postgres`）\n\n---\n\n## 阶段 2：连接数据库\n\n### 前置条件：准备 Public 连接信息\n\n在打开任何工具之前，请先从 Zeabur Dashboard 准备好连接信息。\n\n1. 打开 Zeabur 中的 PostgreSQL 服务。\n2. 点击 **Instruction** 标签页。\n3. 在 **\"Public\"**（External）区域可以看到：\n    - **Connection String**\n    - **PostgreSQL Connect Command**\n    - **PostgreSQL username**\n    - **PostgresSQL password**\n    - **PostgresSQL database**\n    - **PostgreSQL host**\n    - **PostgreSQL port**\n\n---\n\n### 选项 1：使用 VS Code（SQLTools）连接\n\n*适合：希望在同一个窗口里写代码并查看数据库的开发者。*\n\n**步骤 1：安装扩展**\n\n1. 打开 VS Code 或任意兼容的编辑器。\n2. 点击左侧栏的 **Extensions**（`Ctrl+Shift+X` 或 `Cmd+Shift+X`）。\n3. 搜索并安装：**SQLTools**。\n4. 搜索并安装驱动：**SQLTools PostgreSQL/Cockroach Driver**。\n\n**步骤 2：创建连接**\n\n1. 点击左侧栏出现的 **SQLTools** 图标（数据库圆柱）。\n2. 悬停在 “Connections”，点击 **\"Add New Connection\"**（带 `+` 的圆柱图标）。\n3. 选择 **PostgreSQL**。\n\n**步骤 3：配置参数**\n使用 Zeabur 的信息填写表单：\n\n- **Connection Name：** `Zeabur DB`（或任意）\n- **Connect using：** `Server and Port`\n- **Server Address (Host)：** 填入 **Postgresql** **Host**\n- **Port：** 填入 **Postgresql** **Port**\n- **Database：** 填入 **Postgresql** **Database**（通常为 `postgres`）\n- **Username：** 填入 **Postgresql** **User**\n- **Password：** 填入 **Postgresql** **Password**\n- **SSL：** 保持默认（若连接失败可选 \"Require\"）\n\n**步骤 4：测试并连接**\n\n1. 点击 **\"Test Connection\"**，看到 “Successfully Connected” 即成功。\n2. 点击 **\"Save Connection\"**。\n3. 在侧边栏右键连接并选择 **\"Connect\"**。\n4. 现在你可以展开树结构查看 **Tables**、**Views**、**Functions**。\n\n---\n\n### 选项 2：使用 pgAdmin 4（官方 GUI）连接\n\n*适合：使用标准开源管理界面进行更全面的数据库管理。*\n\n**步骤 1：安装 pgAdmin**\n\n1. 下载并安装 [**pgAdmin 4**](https://www.pgadmin.org/download/)。\n2. 打开 pgAdmin 4。（注：在浏览器中打开属于正常现象）\n\n**步骤 2：注册服务器**\n\n1. 在左侧树形栏中右键 **Servers**。\n2. 选择 **Register** > **Server...**\n\n**步骤 3：填写凭据**\n将弹出窗口。你需要填写这些标签页：\n\n- **Tab 1: General**\n    - **Name：** 自定义名称（例如 `Zeabur App DB`）\n- **Tab 2: Connection**\n    - **Host name/address：** 填入 **Postgresql** **Host**\n    - **Port：** 填入 **Postgresql** **Port**\n    - **Maintenance database：** 填入 **Postgresql** **Database**（通常 `postgres`）\n    - **Username：** 填入 **Postgresql** **User**（通常 `root`）\n    - **Password：** 填入 **Postgresql** **Password**\n    - *可选：* 勾选 “Save Password”\n- **Tab 3: Parameters（可选）**\n    - 若遇到 SSL 错误，请到 **SSL** 标签页将 “SSL mode” 设为 `Require` 或 `Prefer`。\n\n**步骤 4：连接**\n\n1. 点击蓝色 **Save**。\n2. 数据库将出现在左侧列表中。\n3. 点击服务器名旁的 `>` > **Databases** > **postgres** > **Schemas** > **public** > **Tables** 查看数据。\n\n---\n\n## 阶段 3：连接你的应用（服务间互连）\n\n当你把应用部署到 Zeabur 时，它需要与此数据库通信。建议使用 **Private Networking** 以获得更好的安全性和性能。\n\n### 方法 A：简单方式（环境变量）\n\nZeabur 会自动向同一项目中的其它服务暴露连接字符串。在你的应用服务设置中：\n\n1. 打开 **Variables** 标签页。\n2. 新增变量 `DATABASE_URL`（或你的代码使用的名称）。\n3. 值使用 Zeabur 引用变量：*会自动带入安全的内部连接字符串*。\n    \n    ```bash\n    ${POSTGRES_CONNECTION_STRING}\n    \n    ```\n    \n\n### 方法 B：手动方式（指定变量）\n\n如果你需要连接信息的某些字段（或有多个 DB），可使用：\n\n- **Host：** `${POSTGRES_HOST}`（内部主机名，通常以 `.zeabur.internal` 结尾）\n- **Port：** `${POSTGRES_PORT}`\n- **User：** `${POSTGRES_USERNAME}`\n- **Password：** `${POSTGRES_PASSWORD}`\n\n> 注意：如果项目里有多个 PostgreSQL 实例，引用变量可能不可靠。此时建议从 Networking 标签页手动复制 “Internal” 的 Hostname 和 Port。\n>\n\n---\n\n## 阶段 4：维护与备份\n\n### 配置（进阶）\n\n如果你需要调整某些数据库设置（例如内存限制或日志）：\n\n1. 在 Zeabur 打开 **Config Editor**。\n2. 编辑 `/etc/postgresql/postgresql.conf`。\n3. *提示：Zeabur 已预先配置关键参数，通常不需要修改。*\n\n### 恢复备份\n\nZeabur 会自动备份。恢复步骤如下：\n\n1. **下载：** 从 Zeabur 的备份存储下载并解压备份文件，你会获得 `data.sql`。\n2. **准备：** 确保本地已安装 PostgreSQL 客户端工具。\n3. **执行：** 在 Instructions 中找到 **\"PostgreSQL Connect Command\"** 并在终端执行。*示例：* `psql -h postgres.zeabur.app -p 5432 -U root postgres < data.sql`\n    \n    ```bash\n    <Your PostgreSQL Connect Command> < data.sql\n    \n    ```\n    \n\n> 警告：恢复备份会覆盖现有数据并替换用户密码。如需保留当前密码，请在执行前从 `data.sql` 中移除 CREATE ROLE 与 ALTER ROLE 语句。\n>\n"
    zh-TW:
        description: 功能強大且可靠的開源物件關聯式資料庫，具備 ACID 合規與嚴格資料完整性，適合複雜查詢。
        readme: "# 部署 PostgreSQL\n\n**PostgreSQL**（常稱 Postgres）是一套功能強大的開源物件關聯式資料庫系統，以高可靠性、豐富功能與對 SQL 標準的遵循而聞名。它非常適合需要複雜查詢、ACID 合規與嚴格資料完整性的應用。\n\nZeabur 讓關聯式資料庫的管理變得更輕鬆。透過 Zeabur，你可以在幾秒內啟動可用於生產環境的 PostgreSQL 實例，無需處理複雜設定檔、儲存卷或伺服器維運。\n\n### 你將學到什麼\n\n在本教學中，我們將帶你完成：\n\n1. 從 Zeabur Marketplace 部署 PostgreSQL 服務\n2. 使用 **TablePlus**、**pgAdmin** 或 **psql** 等外部工具連線資料庫\n3. 將已部署的後端應用連接到 PostgreSQL\n\n---\n\n## 階段 1：部署資料庫\n\n### 步驟 1：建立 PostgreSQL 服務\n\nZeabur 提供「一鍵部署」，因此你很少需要手動調整複雜設定。\n\n**選項 1：從專案頁建立 PostgreSQL 實例**\n\n1. 登入 [**Zeabur Dashboard**](https://zeabur.com/)。\n2. 點擊 **\"New Project\"**。\n3. 選擇 **\"Template\"**（Marketplace）。\n4. 搜尋 `PostgreSQL`。\n5. 選擇官方 **PostgreSQL** 映像，服務會立即開始部署。\n\n**選項 2：從模板頁建立 PostgreSQL 實例**\n\n1. 登入 [**Zeabur Dashboard**](https://zeabur.com/)。\n2. 選擇 `Features` 與 `Template`。\n3. 選擇或搜尋 `PostgreSQL`。\n4. 選擇 `PostgreSQL`（通常是官方映像），點擊 `deploy` 開始部署。\n\n### 步驟 2：取得連線憑證\n\n1. 進入服務的 **Instruction** 分頁。\n2. 找到 **\"Connection\"** 區塊，你會看到兩種資訊：\n    - **Public (External)：** 給 VS Code / 本機應用使用\n    - **Private (Internal)：** 給已部署的應用使用\n3. 從 **Public** 區塊記下以下內容：\n    - **Host：**（例如 `postgres.zeabur.app`）\n    - **Port：**（通常是 `5432` 或隨機連線埠）\n    - **Username：**（預設通常是 `root` 或 `postgres`）\n    - **Password：**（點擊「眼睛」圖示顯示）\n    - **Database：**（預設是 `postgres`）\n\n---\n\n## 階段 2：連線資料庫\n\n### 前置條件：準備 Public 連線資訊\n\n在開啟任何工具前，請先在 Zeabur Dashboard 準備好連線資訊。\n\n1. 開啟 Zeabur 中的 PostgreSQL 服務。\n2. 點擊 **Instruction** 分頁。\n3. 在 **\"Public\"**（External）區塊可取得：\n    - **Connection String**\n    - **PostgreSQL Connect Command**\n    - **PostgreSQL username**\n    - **PostgresSQL password**\n    - **PostgresSQL database**\n    - **PostgreSQL host**\n    - **PostgreSQL port**\n\n---\n\n### 選項 1：使用 VS Code（SQLTools）連線\n\n*適合：想在同一個視窗寫程式並查看資料庫的開發者。*\n\n**步驟 1：安裝擴充套件**\n\n1. 開啟 VS Code 或任何相容的編輯器。\n2. 點擊左側欄的 **Extensions**（`Ctrl+Shift+X` 或 `Cmd+Shift+X`）。\n3. 搜尋並安裝：**SQLTools**。\n4. 搜尋並安裝驅動：**SQLTools PostgreSQL/Cockroach Driver**。\n\n**步驟 2：建立連線**\n\n1. 點擊左側欄出現的 **SQLTools** 圖示（資料庫圓柱）。\n2. 將滑鼠移到 “Connections”，點擊 **\"Add New Connection\"**（帶 `+` 的圓柱圖示）。\n3. 選擇 **PostgreSQL**。\n\n**步驟 3：設定參數**\n使用 Zeabur 的資訊填寫：\n\n- **Connection Name：** `Zeabur DB`（或任意）\n- **Connect using：** `Server and Port`\n- **Server Address (Host)：** 貼上 **Postgresql** **Host**\n- **Port：** 貼上 **Postgresql** **Port**\n- **Database：** 貼上 **Postgresql** **Database**（通常 `postgres`）\n- **Username：** 貼上 **Postgresql** **User**\n- **Password：** 貼上 **Postgresql** **Password**\n- **SSL：** 保持預設（若連線失敗可改為 \"Require\"）\n\n**步驟 4：測試並連線**\n\n1. 點擊 **\"Test Connection\"**，看到 “Successfully Connected” 即成功。\n2. 點擊 **\"Save Connection\"**。\n3. 在側邊欄右鍵連線並選擇 **\"Connect\"**。\n4. 你可以展開樹狀結構查看 **Tables**、**Views**、**Functions**。\n\n---\n\n### 選項 2：使用 pgAdmin 4（官方 GUI）連線\n\n*適合：使用標準開源介面進行更完整的資料庫管理。*\n\n**步驟 1：安裝 pgAdmin**\n\n1. 下載並安裝 [**pgAdmin 4**](https://www.pgadmin.org/download/)。\n2. 開啟 pgAdmin 4。（註：在瀏覽器中開啟屬正常）\n\n**步驟 2：註冊伺服器**\n\n1. 在左側樹狀欄右鍵 **Servers**。\n2. 選擇 **Register** > **Server...**\n\n**步驟 3：輸入憑證**\n會出現視窗，請填寫以下分頁：\n\n- **Tab 1: General**\n    - **Name：** 自訂名稱（例如 `Zeabur App DB`）\n- **Tab 2: Connection**\n    - **Host name/address：** 貼上 **Postgresql** **Host**\n    - **Port：** 貼上 **Postgresql** **Port**\n    - **Maintenance database：** 貼上 **Postgresql** **Database**（通常 `postgres`）\n    - **Username：** 貼上 **Postgresql** **User**（通常 `root`）\n    - **Password：** 貼上 **Postgresql** **Password**\n    - *可選：* 勾選 “Save Password”\n- **Tab 3: Parameters（可選）**\n    - 若遇到 SSL 問題，請到 **SSL** 分頁將 “SSL mode” 設為 `Require` 或 `Prefer`。\n\n**步驟 4：連線**\n\n1. 點擊藍色 **Save**。\n2. 資料庫將出現在左側清單。\n3. 點擊伺服器旁的 `>` > **Databases** > **postgres** > **Schemas** > **public** > **Tables** 查看資料。\n\n---\n\n## 階段 3：連接你的應用（服務間互連）\n\n當你將應用部署到 Zeabur（例如透過 AI Studio / GitHub）後，應用需要與此資料庫通訊。建議使用 **Private Networking** 以提升安全性與速度。\n\n### 方法 A：簡單方式（環境變數）\n\nZeabur 會自動向同一專案中的其他服務暴露連線字串。在你的應用服務設定中：\n\n1. 前往 **Variables** 分頁。\n2. 新增變數 `DATABASE_URL`（或你的程式使用的名稱）。\n3. 值使用 Zeabur 參考變數：*會自動帶入安全的內部連線字串*。\n    \n    ```bash\n    ${POSTGRES_CONNECTION_STRING}\n    \n    ```\n    \n\n### 方法 B：手動方式（指定變數）\n\n若你需要連線資訊的某些欄位（或有多個 DB），可使用：\n\n- **Host：** `${POSTGRES_HOST}`（內網主機名，通常以 `.zeabur.internal` 結尾）\n- **Port：** `${POSTGRES_PORT}`\n- **User：** `${POSTGRES_USERNAME}`\n- **Password：** `${POSTGRES_PASSWORD}`\n\n> 注意：若你的專案含多個 PostgreSQL 實例，參考變數可能不可靠。此時建議從 Networking 分頁手動複製 “Internal” 的 Hostname 與 Port。\n>\n\n---\n\n## 階段 4：維護與備份\n\n### 設定（進階）\n\n若你需要調整特定資料庫設定（例如記憶體限制或日誌）：\n\n1. 在 Zeabur 開啟 **Config Editor**。\n2. 編輯 `/etc/postgresql/postgresql.conf`。\n3. *提示：Zeabur 已預先配置必要設定，多數情況不需要更動。*\n\n### 還原備份\n\nZeabur 會自動備份。要還原：\n\n1. **下載：** 從 Zeabur 的備份儲存下載並解壓備份檔案，你會得到 `data.sql`。\n2. **準備：** 確保本機已安裝 PostgreSQL 用戶端工具。\n3. **執行：** 在 Instructions 找到 **\"PostgreSQL Connect Command\"** 並在終端機執行。*範例：* `psql -h postgres.zeabur.app -p 5432 -U root postgres < data.sql`\n    \n    ```bash\n    <Your PostgreSQL Connect Command> < data.sql\n    \n    ```\n    \n\n> 警告：還原備份會覆蓋現有資料並替換使用者密碼。若想保留目前密碼，請在執行前先從 `data.sql` 中移除 CREATE ROLE 與 ALTER ROLE 語句。\n>"
