Skip to content

Commit ad6b22f

Browse files
committed
add unbooks and update readme for prod db surgery
1 parent c6f072f commit ad6b22f

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,30 @@ To run only missing gap-analysis pair backfill (without starting Flask), use:
143143
RUN_COUNT=8 bash scripts/backfill_gap_analysis.sh
144144
```
145145

146-
To sync local Postgres data into a Heroku app (staging or prod), use:
146+
### Production DB Operations (opencreorg)
147+
148+
Prefer the dedicated scripts in `scripts/db/` for production operations. These scripts enforce safety guards and always capture a fresh backup before DB changes.
149+
150+
- Backup only:
151+
- `APP_NAME=opencreorg scripts/db/backup-opencreorg.sh`
152+
- Sync local Postgres to Heroku:
153+
- `APP_NAME=opencreorg SOURCE_DB_URL="postgresql://cre:password@127.0.0.1:5432/cre" scripts/db/sync-local-to-opencreorg.sh`
154+
- Targeted SQL surgery:
155+
- `APP_NAME=opencreorg scripts/db/surgery-opencreorg.sh --sql-file ./tmp/change.sql`
156+
157+
For destructive surgery (`DELETE`, `DROP`, `TRUNCATE`, irreversible `ALTER`), use:
147158

148159
```bash
149-
APP_NAME=stagingopencreorg \
150-
SOURCE_DB_URL="postgresql://cre:password@127.0.0.1:5432/cre" \
151-
SYNC_TABLES=gap_analysis \
152-
bash scripts/push-local-postgres-to-heroku.sh --gap_analysis
160+
APP_NAME=opencreorg \
161+
CONFIRM_DESTRUCTIVE=I_UNDERSTAND_OPENCREORG_PROD_DB_DESTRUCTIVE_ACTION \
162+
scripts/db/surgery-opencreorg.sh --sql-file ./tmp/destructive-change.sql --destructive
153163
```
154164

165+
Runbooks:
166+
167+
- `docs/runbooks/opencreorg-db-sync-and-surgery.md`
168+
- `docs/runbooks/opencreorg-db-destructive-ops-checklist.md`
169+
155170
Environment variables for app to connect to neo4jDB (default):
156171

157172
* `NEO4J_URL` (neo4j//neo4j:password@localhost:7687)

0 commit comments

Comments
 (0)