Resets staging database with full schema drop. Use for schema changes or migrations. SINGLE SOURCE OF TRUTH for staging database reset automation.
Purpose: Full database reset for staging environment - drops all tables and lets migrations rebuild.
When to Use:
When NOT to Use:
Background Documentation: See /docs/guides-setup/database-setup.md (Staging Database Management section) for context and manual procedures.
This skill performs DESTRUCTIVE operations:
witchcityrope_staging)Note: DigitalOcean managed databases don't allow dropping the public schema (owned by doadmin). This skill drops all tables owned by witchcity_staging user instead.
Prerequisites:
staging-deploy skill first)Executable Script: execute.sh
# From project root - with confirmation prompt
bash .claude/skills/database-reset-staging/execute.sh
# Skip confirmation prompt (for automation)
SKIP_CONFIRMATION=true bash .claude/skills/database-reset-staging/execute.sh
What the script does:
.env.staging)witchcity_staging user (CASCADE)Script includes CRITICAL safety warnings - this is a DESTRUCTIVE operation that cannot be undone.
If skill fails, manual steps:
Prerequisites: Get DB credentials from server first
ssh witchcity@104.131.165.14 'cat /opt/witchcityrope/staging/.env.staging | grep STAGING_DB_CONNECTION_STRING'
Manual table drop: Connect to database and execute:
-- Generate DROP statements for all tables owned by witchcity_staging
SELECT 'DROP TABLE IF EXISTS "' || tablename || '" CASCADE;'
FROM pg_tables
WHERE schemaname = 'public' AND tableowner = 'witchcity_staging';
-- Then execute the generated statements
Then: Restart staging containers via SSH:
ssh witchcity@104.131.165.14 'cd /opt/witchcityrope/staging && docker compose -f docker-compose.staging.yml up -d --force-recreate api'
Cause: PostgreSQL client not installed locally
Solution:
# Ubuntu/Debian
sudo apt install postgresql-client
# macOS
brew install postgresql
Cause: Firewall or network issue
Solution:
ssh witchcity@104.131.165.14restart-dev-containers skillCause: Old migration state or code/DB mismatch
Solution:
restart-dev-containers skillstaging-deploy skillCause: Seed condition not met
Solution:
appsettings.Staging.json has SeedData: truerestart-dev-containers skillTypical workflow:
staging-deploy skillrestart-dev-containers skill to check logswitchcity_staging user cannot drop public schema (owned by doadmin)witchcity_staging with CASCADEdocs/functional-areas/deployment/staging-deployment-guide.mddocs/guides-setup/database-setup.mdRemember: This skill is for staging only. Never use on production. Always use staging-deploy skill first to ensure latest code is deployed.