mirror of
https://origin.cursor.com/mrdevmx/panels.git
synced 2026-10-09 10:43:18 +00:00
No description
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Problem Coolify deploy built all images successfully but failed when the `migrate` job exited with code 1. The IAM changeset `005-iam-v2-roles-crud.sql` had already applied through `005g` on production; it failed at `005h-swap-roles`. ## Root cause Changeset `005h` used `splitStatements:true` with `endDelimiter:;` while containing a `DO $$ ... END $$` block. Liquibase splits on every semicolon, which breaks PL/pgSQL blocks and causes the migrate step to fail. Secondary risks on production data: - Users without `role_id` after backfill (missing per-tenant `operativo` role) - Multiple `tenant_admin` users in the same tenant (unique partial index would fail) ## Fix 1. **Move the unique-index `DO` block** to a new changeset `005h2-unique-tenant-admin` with `splitStatements:false`. 2. **Add changeset `005g2-ensure-role-backfill`** (new, safe for DBs that already ran `005g`): - Create `operativo` roles for every tenant that has users - Re-backfill any remaining `role_id` - Demote duplicate tenant admins to `operativo` (keep lowest `id` per tenant) - Remove orphan users without `tenant_id` ## Deploy Merge to `main` and redeploy in Coolify. No manual SQL should be required if the DB stopped at `005h` as expected. If migrate still fails, capture logs with: ```bash docker logs migrate-pdyrt8ccp804tfmutefau0k6-<latest> 2>&1 | tail -100 ``` <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-0da3751a-38ff-40ab-bba2-5df2322c8cda?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-0da3751a-38ff-40ab-bba2-5df2322c8cda&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> |
||
|---|---|---|
| .github/workflows | ||
| api | ||
| db | ||
| docs | ||
| overlays | ||
| scripts | ||
| tmp/pdfs | ||
| web | ||
| web-panel | ||
| web-saas | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| docker-compose.yml | ||
| Dockerfile.api | ||
| Dockerfile.migrate | ||
| Dockerfile.provision | ||
| Dockerfile.web-panel | ||
| Dockerfile.web-saas | ||
| package.json | ||