# WP1 — [migration] add per-line warehouse_id + owner_partner_id to inventory_issue_items

## Goal
Give each inventory-issue LINE its own optional source warehouse and owner (consignor), so a production material issue can route each material to a different warehouse (own or consignment) and, for consignment, a specific customer. This WP is schema + model only — no behavior yet.

## Exact files
- NEW migration under `Modules/Inventory/database/migrations/` — timestamp AFTER all existing (sorts last). Add to `inventory_issue_items`:
  - `warehouse_id` — `unsignedBigInteger` NULLABLE, FK → `warehouses(id)` `nullOnDelete`, indexed. Comment: "ISS-9166: per-line source warehouse; NULL = use the issue-level warehouse."
  - `owner_partner_id` — `unsignedBigInteger` NULLABLE, indexed (NO FK — mirrors `inventory_lot_balances.owner_partner_id` semantics: 0 = company/on-book, >0 = a business_partners.id consignor; NULL = derive ownership as today). Comment to that effect.
  - `down()` drops both columns (drop FK first).
- `Modules/Inventory/app/Models/InventoryIssueItem.php` (~:19-39) — add `'warehouse_id'` and `'owner_partner_id'` to `$fillable`. Add a `warehouse()` BelongsTo if the model doesn't have one (optional; only if trivial). Do NOT add casts that change behavior (nullable ints).

## Interfaces (for WP2–WP6)
- `inventory_issue_items.warehouse_id` (nullable) — WP2 (ApproveIssue) reads `$item->warehouse_id ?? $issue->warehouse_id`; WP3 (IssueMaterials::createDraftInventoryIssue) stamps it per item.
- `inventory_issue_items.owner_partner_id` (nullable; 0=own, >0=consignor, NULL=derive) — WP3 ownership override; WP5 listener rebuild reads it.

## Acceptance
- Migration runs clean up + down on dev (`moonui2_dev_be`) — apply it in this WP (dev BE runs live). ⛔ never fresh/wipe.
- Both columns exist on `inventory_issue_items`, nullable, default NULL. Existing rows unaffected (all NULL → OFF-path byte-for-byte).
- Model fillable includes both.

## Tests
- No behavior to test yet. Add a tiny migration/columns assertion is optional. The gate is: migrate up+down clean on sqlite (the test DB re-migrates) and `php artisan migrate --force` clean on dev.
- Confirm the baseline suites still pass unchanged (nothing reads the columns yet): re-run ProductionMaterialOwnershipTest + InventoryIssueApiTest (should be identical to baseline; ConsignmentFoundationTest settle-buy stays pre-existing-red).

## Flags
- **migration: YES** — run on dev same step. Timestamp sorts after existing. Conventional commit `feat(inventory): per-line warehouse_id + owner_partner_id on issue items (ISS-2026-9166)` on hazemdev2. No FE. If edited as root, chown moonui2:moonui2.

## Out of scope
- Any behavior (WP2+). Do NOT touch ApproveIssue/IssueMaterials/controllers here — columns only.
