> For the complete documentation index, see [llms.txt](https://docs.menanak47.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.menanak47.com/multi-framework/ak47_inventory/guides/migration.md).

# Migration

If you are replacing an existing inventory system (specifically **OX Inventory** or **Quasar (qs) Inventory**), `ak47_inventory` includes powerful built-in migration tools to seamlessly transfer your server's data.

#### Player Data Migration (Automatic)

When you first start `ak47_inventory`, the `server/_init.lua` script will attempt to detect if you are running an existing `ox_inventory`, `esx`, or `qbcore` inventory database structure.

* **OX Inventory:** It will automatically read the `ox_inventory` database tables and migrate players, vehicles, and stashes into the `ak47_inventory` format.
* **ESX/QBCore Native:** It will decode the `users` (or `players`) table's JSON inventory data and reconstruct it securely inside `ak47_inventory`.

> \[!WARNING] After the automatic database migration completes, you will see a message instructing you to restart your server. You **must** restart the server to finalize the data loading.

#### Item & Config Migration (`convert/converter.lua`)

If you have heavily customized items and weapons in OX or Quasar, you do not need to manually rewrite them into `ak47_inventory` format. The `convert/` folder handles this.

1. Locate the `convert/ox/` or `convert/qs/` folders.
2. Place your existing `items.lua` or `weapons.lua` from your old inventory into the corresponding folder.
3. Start the `ak47_inventory` script.
4. The system will detect the old item lists and execute `convert/converter.lua`.
5. Your old items, weights, and durability logic will be automatically rewritten into `ak47_inventory` format and saved into the `shared/` directory.

> \[!TIP] Just like with the database migration, if the converter successfully converts items, you will see a console prompt telling you to restart the inventory to load the new converted items.
