# Database

## Storage

Dealer configuration is stored in `data/dealers.json` and the database.

Discount codes are stored in the database. The `codes` table in the configuration only seeds initial codes on first start.

:::hint{type="warning"}
In-game edits overwrite `data/dealers.json`. Stop the resource before editing this file manually.
:::

## Tables

Tables are created automatically on first start.

When `KOJA.CreateAutoTable` is `false`, import `koja-cardealer.sql` manually.

## Price calculation

Prices are calculated server-side in this order:

1. Base vehicle price
2. Promotion discount
3. VIP discount
4. Coupon discount

## Related pages

- [Configuration](/free/car-dealer-v2/configuration) — Configure defaults, images, prestige integration, and UI builds.
- [Features](/free/car-dealer-v2/features) — Player-facing dealership, progression, promotion, and leasing features.
- [Installation](/free/car-dealer-v2/installation) — Install Car Dealer V2 and its required dependencies.
- [Exports & Commands](/free/car-dealer-v2/exports-and-commands) — Admin, leasing, and prestige commands with available server exports.
- [Admin Menu](/free/car-dealer-v2/admin-menu) — Create and manage dealerships live in-game.
- [Car Dealer V2](/free/car-dealer-v2) — back to the section overview
