> For the complete documentation index, see [llms.txt](https://tweak5m.gitbook.io/tweak5m-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tweak5m.gitbook.io/tweak5m-docs/noir-backpacks/sql-setup.md).

# SQL setup

**NOIR Backpacks · Version 1.0.1**

[1 · Install](/tweak5m-docs/noir-backpacks/installation.md) → [2 · Database](/tweak5m-docs/noir-backpacks/sql-setup.md) → [3 · Items & icons](/tweak5m-docs/noir-backpacks/items-and-icons.md) → start and test

## What this step does

Creates `cfx_tweak_noir_backpacks`, this pack's bag registry. ox\_inventory saves the actual stash contents separately. This does not give players items. The Library has no SQL import.

{% hint style="warning" %}
Back up the database first. This is fresh-install SQL, not a migration for an existing table. Do not delete tables or player metadata to fix an error. `IF NOT EXISTS` will not upgrade an older table's structure.
{% endhint %}

## 1. Select the right database

Open your normal database tool (such as HeidiSQL or phpMyAdmin). Select the same database your server already uses through oxmysql. Open a new SQL/query tab. You do not need to create a second database or change your connection password.

## 2. Copy and run this SQL

This is the complete `install/sql/database.sql` from the NOIR Backpacks 1.0.1 package. Use the copy button on the code block, paste into your SQL/query tab, and execute it once for a fresh installation.

```sql
CREATE TABLE IF NOT EXISTS `cfx_tweak_noir_backpacks` (
    `bag_id` varchar(36) NOT NULL,
    `item` varchar(64) NOT NULL,
    `generation` int unsigned NOT NULL DEFAULT 1,
    `status` varchar(16) NOT NULL,
    `payload` longtext NOT NULL,
    `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`bag_id`),
    KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```

## 3. Confirm the table exists

Refresh your database's table list, or run this read-only check in the same database:

```sql
SHOW COLUMNS FROM `cfx_tweak_noir_backpacks`;
```

You should see columns including `bag_id`, `item`, `generation`, `status` and `payload`. An empty registry after installation is normal. If the table already existed, compare its structure before continuing; this create statement does not migrate it.

## If something goes wrong

* **Permission denied:** use a database account allowed to create this table.
* **No database selected:** select your existing server database, then retry.
* **Resource says table missing:** confirm you imported into the database configured for oxmysql and use this pack's exact table name.
* **Connection error:** check your existing oxmysql setup. Never share the connection password in a screenshot or ticket.

**Next:** [Register the inventory items and icons](/tweak5m-docs/noir-backpacks/items-and-icons.md).
