fix: add provider column migration script for existing db
This commit is contained in:
@@ -7,6 +7,27 @@ psql "$DATABASE_URL" -f scripts/init_schema.sql
|
||||
```
|
||||
- DB schema 檔案:[backend/scripts/init_schema.sql](../backend/scripts/init_schema.sql)
|
||||
|
||||
如果你是 macOS 本機沒裝 `psql`,改用:
|
||||
```bash
|
||||
cd backend
|
||||
./.venv/bin/python - <<'PY'
|
||||
import psycopg
|
||||
from pathlib import Path
|
||||
sql = Path('scripts/migrate_provider_columns.sql').read_text()
|
||||
with psycopg.connect(
|
||||
host='127.0.0.1',
|
||||
port=54321,
|
||||
dbname='member.ose.tw',
|
||||
user='member_ose',
|
||||
password='你的DB密碼'
|
||||
) as conn:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute(sql)
|
||||
print('provider column migration done')
|
||||
PY
|
||||
```
|
||||
- 欄位改名 migration:[backend/scripts/migrate_provider_columns.sql](../backend/scripts/migrate_provider_columns.sql)
|
||||
|
||||
## 2) 啟動後端
|
||||
```bash
|
||||
cd backend
|
||||
|
||||
Reference in New Issue
Block a user