---
tags: [inventory, database]
module: Inventory
---

# [DB]DatabaseTables

## Connections
[[_Inventory]] · [[[Model]Warehouse]] · [[[Model]Requisition]] · [[[Model]WarehouseProductLog]]

## Tables (tenant connection)

### warehouses
| Column | Type | Notes |
|---|---|---|
| id | bigInt | PK |
| title_ar / title_en | string | translatable |
| address | string | nullable |
| cost_center_id | FK → cost_centers | nullable |
| is_main | boolean | default true; only one active main |
| parent_warehouse_id | FK → warehouses | self-ref hierarchy, nullable |
| status | string | WarehouseStatusEnum |
| account_id | FK → accounts | nullable |
| created_by | FK → users | |
| deleted_at | timestamp | soft delete |

Seeded with 'Main Warehouse' default.

### requisitions
| Column | Type | Notes |
|---|---|---|
| id | bigInt | PK |
| reference | string | auto-generated |
| type | string | INBOUND / OUTBOUND / TRANSFER |
| warehouse_id | FK → warehouses | destination |
| from_warehouse_id | FK → warehouses | source (TRANSFER only) |
| supplier_id | FK → suppliers | INBOUND |
| customer_id | FK → customers | OUTBOUND |
| date | date | |
| status | string | RequisitionStatusEnum |
| stock_movement | boolean | was ApplyRequisitionStockMovementService called? |
| notes | text | nullable |
| created_by | FK → users | |
| deleted_at | timestamp | soft delete |

### requisition_products
| Column | Type | Notes |
|---|---|---|
| requisition_id | FK → requisitions | cascade delete |
| product_id | FK → products | |
| warehouse_product_id | FK → warehouse_products | |
| quantity | double | 3 decimal precision |
| price | decimal 13,2 | |
| tax_id | FK → taxes | |
| vat_value | decimal | |
| discount | decimal | |
| deleted_at | timestamp | soft delete |

### warehouse_product_logs
| Column | Type | Notes |
|---|---|---|
| warehouse_id | FK → warehouses | cascade delete |
| product_id | FK → products | cascade delete |
| cost_center_id | FK → cost_centers | set null on delete |
| entity_id | unsigned int | polymorphic |
| entity_type | string | polymorphic: Invoice/Requisition/Bill etc. |
| quantity_before / after | double | default 0 |
| quantity | double | delta |
| log_type | string | INBOUND / OUTBOUND |
| created_by | FK → users | |
| deleted_at | timestamp | soft delete |
| INDEX | [entity_id, entity_type] | |
