Files

24 lines
736 B
Bash
Raw Permalink Normal View History

#!/bin/bash
# 共享 postgres 初始化:创建分库 + 在需要的库启用 pgvector 扩展
set -e
set -u
echo "[init-db] 创建分库: chatwoot, twenty, products"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE DATABASE chatwoot;
CREATE DATABASE twenty;
CREATE DATABASE products;
EOSQL
echo "[init-db] 在 chatwoot / products 库启用 pgvector 扩展"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" -d chatwoot <<-EOSQL
CREATE EXTENSION IF NOT EXISTS vector;
EOSQL
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" -d products <<-EOSQL
CREATE EXTENSION IF NOT EXISTS vector;
EOSQL
echo "[init-db] 完成。库列表:"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" -c "\l"