> For the complete documentation index, see [llms.txt](https://atiysus-organization.gitbook.io/aty-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://atiysus-organization.gitbook.io/aty-scripts/restaurant-creator/getting-started/database.md).

# Database

Import **`data/install.sql`** once, before starting the resource. It is safe to re-run (`CREATE TABLE IF NOT EXISTS`).

#### Tables

| Table                               | Stores                                                                                                                                           |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `aty_restaurants`                   | Each restaurant: owner, price, funds, hygiene, reputation, state, and a JSON `data` blob (zone points, blip, employees, ranks, menu, settings…). |
| `aty_restaurant_stations`           | Every placed station (type + coords JSON) linked to its restaurant.                                                                              |
| `aty_restaurant_freezers`           | Persistent freezer/storage stock per restaurant.                                                                                                 |
| `aty_restaurant_sales`              | Sales history used by the dashboard performance charts.                                                                                          |
| `aty_restaurant_tenders`            | Payment tenders / receipts.                                                                                                                      |
| `aty_restaurant_pending_deliveries` | Wholesale/supply orders awaiting delivery.                                                                                                       |
| `aty_player_biometrics`             | Per-character hidden allergies and biometric state.                                                                                              |
| `aty_pizza_boxes`                   | Persistent dropped/placed pizza boxes.                                                                                                           |

#### Notes

* Restaurants are **fully dynamic** — there are no static/config restaurants. Everything an owner or admin builds is written here and re-loaded on restart.
* The heavy state (zone polygon, stations, employees, ranks, menu, CCTV, settings) lives in the `data` JSON column of `aty_restaurants`, kept in sync with a server-side cache and replicated to clients via `GlobalState`.
* Deleting a restaurant row (or via the admin menu) removes its stations and stored stock.

{% hint style="danger" %}
Always back up before manual SQL edits. The `data` column is JSON — malformed JSON will prevent that restaurant from loading.
{% endhint %}
