]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commit
feat(ERP-33): заменить StockHistory (snapshot) на StockState (SCD-2)
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Tue, 24 Mar 2026 09:48:40 +0000 (12:48 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Tue, 24 Mar 2026 09:48:40 +0000 (12:48 +0300)
commit8e0b08fb917460ea9259d9c692ca7a6928d8da0c
tree6fe88500a5aff3ffaad5a158a008fe64685af329
parent3c68722b2c6446facf1f3c128abaed72db9f4791
feat(ERP-33): заменить StockHistory (snapshot) на StockState (SCD-2)

Полная переделка подхода хранения остатков:
- StockHistory (полные снимки 11400 INSERT/запуск) → StockState (SCD-2, 2 SQL)
- Без партиций — одна таблица с valid_from/valid_to (TIMESTAMP)
- valid_to = '2100-01-01 00:00:00' для активных, закрытие на секунду раньше
- is_active boolean для быстрой фильтрации
- batch_ts — единый timestamp пакета на запуск
- Экономия ~78% объёма (660 MB vs 3 GB за 2 года)
- 10 unit-тестов, 29 assertions
12 files changed:
erp24/commands/StockHistoryController.php [deleted file]
erp24/commands/StockStateController.php [new file with mode: 0644]
erp24/migrations/m260221_100000_create_stock_history_table.php [deleted file]
erp24/migrations/m260221_100000_create_stock_state_table.php [new file with mode: 0644]
erp24/records/StockHistory.php [deleted file]
erp24/records/StockState.php [new file with mode: 0644]
erp24/services/CollectResult.php
erp24/services/DqResult.php
erp24/services/StockHistoryService.php [deleted file]
erp24/services/StockStateService.php [new file with mode: 0644]
erp24/tests/unit/services/StockHistoryServiceTest.php [deleted file]
erp24/tests/unit/services/StockStateServiceTest.php [new file with mode: 0644]