Skip to content

fix: make grid seed migrations idempotent#103

Merged
biz87 merged 1 commit intobetafrom
fix/idempotent-grid-migrations
Feb 19, 2026
Merged

fix: make grid seed migrations idempotent#103
biz87 merged 1 commit intobetafrom
fix/idempotent-grid-migrations

Conversation

@biz87
Copy link
Copy Markdown
Member

@biz87 biz87 commented Feb 19, 2026

Summary

  • Добавлен SELECT COUNT(*) guard в seed_orders_grid_config — если записи orders grid уже есть, миграция пропускается
  • Расширен DELETE в update_orders_grid_status_fields — перед INSERT удаляются все три новых поля (status_name, order_status, status_color), а не только старое status_name

Проблема: при частичном выполнении миграции 20260119220000 (Phinx + MySQL = нет транзакций) запись order_status оставалась в БД, повторный запуск падал с Duplicate entry 'orders-order_status'.

Test plan

  • Чистая установка — миграции проходят без ошибок
  • Повторный запуск миграций — seed пропускается, update не падает на duplicate

🤖 Generated with Claude Code

Add COUNT guard to seed_orders_grid_config to skip if records exist.
Expand DELETE in update_orders_grid_status_fields to cover all three
new fields (status_name, order_status, status_color) before INSERT,
preventing Duplicate entry error on partial re-runs.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@biz87 biz87 merged commit cf6f8b6 into beta Feb 19, 2026
@biz87 biz87 mentioned this pull request Feb 20, 2026
5 tasks
@Ibochkarev Ibochkarev deleted the fix/idempotent-grid-migrations branch March 16, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants