fix: restore DB script and migrations
This commit is contained in:
@@ -15,23 +15,20 @@ else
|
||||
docker exec dagi-postgres psql -U postgres -c "CREATE DATABASE daarion_memory;"
|
||||
fi
|
||||
|
||||
# 3. Apply all migrations in order
|
||||
# 3. Setup extensions
|
||||
echo "Enabling extensions..."
|
||||
docker exec dagi-postgres psql -U postgres -d daarion_memory -c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp";'
|
||||
|
||||
# 4. Apply all migrations in order
|
||||
echo "Applying migrations..."
|
||||
for f in migrations/*.sql; do
|
||||
echo "Applying $f..."
|
||||
# Check if migration needed?
|
||||
# For simplicity in this recovery script, we assume psql will handle "IF NOT EXISTS" errors
|
||||
# or we just run them.
|
||||
# Real production migration tools track versions.
|
||||
# Here we rely on SQL idempotency or manual check.
|
||||
# Most of our recent migrations use "CREATE TABLE IF NOT EXISTS".
|
||||
# Let's run them.
|
||||
docker exec -i dagi-postgres psql -U postgres -d daarion_memory < "$f"
|
||||
docker exec -i dagi-postgres psql -U postgres -d daarion_memory < "$f" || echo "Warning: Migration $f had errors, continuing..."
|
||||
done
|
||||
|
||||
# 4. Rebuild and restart city-service
|
||||
# 5. Rebuild and restart city-service
|
||||
echo "Restarting city-service..."
|
||||
docker-compose up -d --build city-service
|
||||
docker compose up -d --build city-service
|
||||
|
||||
echo "Deployment and DB restoration complete!"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user