Conversation
- Updated `gen_fix_seed.js` to maintain original positional insert for payroll_calculations and align disposal_vouchers and disposal_voucher_items mappings with legacy export order. - Modified `init-db-and-seed.sh` to allow fallback to legacy seed file if the primary seed file is missing, and added checks to prevent seeding with legacy mock patch markers. - Enhanced `reset-db-and-seed.sh` to enforce strict error handling during seeding, ensuring that legacy mock patch markers are not present in seed files, and improved logging for better traceability. - Removed legacy fallback logic and streamlined seeding strategy to focus on either fix-only or data-only approaches, ensuring critical tables are populated correctly.
There was a problem hiding this comment.
Pull request overview
Refactors the database seeding workflow to prefer deploy/fix_seed.sql, enforce stricter failure behavior during seeding, and add stronger “seed integrity” checks across local scripts and CD deployment.
Changes:
- Switch seeding defaults to
deploy/fix_seed.sqlwith legacydata.sqlfallback in init/local scripts. - Make reset+seed fail fast on SQL errors and validate additional “critical” tables (orders/tickets/loyalty gifts).
- Update
gen_fix_seed.jscolumn mappings (notably disposal vouchers/items) and strip BOM fromdata.sqlinput.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| deploy/scripts/reset-db-and-seed.sh | Strict seeding + expanded post-seed validation; simplified strategies/fallbacks. |
| deploy/scripts/init-db-and-seed.sh | Prefer fix_seed.sql, fallback to legacy seed, and block legacy mock marker. |
| deploy/gen_fix_seed.js | Adjust column mappings and remove BOM before generating fix_seed.sql. |
| deploy/fix_seed.sql | Updated seed dataset and insert column alignment to match expected schema/order. |
| backend/run-seed.cmd | Prefer fix_seed.sql, block legacy mock marker, and add post-seed verification queries. |
| README.md | Document new default seed flow and regeneration instructions. |
| .github/workflows/cd.yml | Expand post-deploy seed integrity checks and run reset+seed in fix-only mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ;; | ||
| *) | ||
| log "ERROR" "Invalid SEED_STRATEGY=$SEED_STRATEGY (allowed: fix-only|fix-first|data-only|data-first)" | ||
| log "ERROR" "Invalid SEED_STRATEGY=$SEED_STRATEGY (allowed: fix-only|data-only)" |
There was a problem hiding this comment.
SEED_STRATEGY validation message is out of sync with what the case statement actually accepts. Here the script supports data-first (and earlier fix-first), but the error message advertises only fix-only|data-only. Please either (a) remove the unsupported strategy patterns from the case statement and the earlier require_file switch, or (b) update the error message (and any docs) to list all supported values consistently.
| log "ERROR" "Invalid SEED_STRATEGY=$SEED_STRATEGY (allowed: fix-only|data-only)" | |
| log "ERROR" "Invalid SEED_STRATEGY=$SEED_STRATEGY (allowed: fix-only|fix-first|data-only|data-first)" |
gen_fix_seed.jsto maintain original positional insert for payroll_calculations and align disposal_vouchers and disposal_voucher_items mappings with legacy export order.init-db-and-seed.shto allow fallback to legacy seed file if the primary seed file is missing, and added checks to prevent seeding with legacy mock patch markers.reset-db-and-seed.shto enforce strict error handling during seeding, ensuring that legacy mock patch markers are not present in seed files, and improved logging for better traceability.