Database
The Eleven Comercios database on FiveM: tables and sample data that install once by themselves (wholesale, vehicles, licenses), what each stores and backups.
Automatic setup
You don't need to import any .sql by hand. Everything installs itself on start:
- Schema. Each resource applies its
sql/schema.sqlbefore anything else. On an empty database it creates every table; on one that already has them it changes nothing (CREATE TABLE IF NOT EXISTS). New columns from later versions are added automatically. - Sample data. The panel (
eleven-comercios-admin) runs its data files fromsql/only once in the life of the database. Each applied file is recorded in thecomercios_migrationstable and never runs again, so whatever you edit later in the panel is not overwritten.
If a file fails, it isn't recorded and is retried on the next start. Every table starts with comercios_.
Warning
Don't delete comercios_migrations. Without it, the panel thinks the database is only half installed.
Sample data
It ships in Spanish whatever Config.Locale says, and isn't assigned to any business: you decide who uses it.
| What | Contents |
|---|---|
| Wholesale | 121 products, all of them ingredients from the package, in the Restauración and Supermercado types. Two General pick-up NPCs. |
| Vehicles | 14 stock GTA models in the fleet catalog (vans, tow trucks, taxi, limo, the taco food truck…). |
| Licenses | 39 sample licenses by category (restaurants, mechanics, nightlife, journalism, transport…). |
| Business types | RESTAURACION, MECANICO, OCIO NOCTURNO, PERIODISMO and TRANSPORTE, with four levels and their perk texts. |
| Level requirement ladder | Only if there are no rules yet. See Levels. |
Edit or delete it from /comerciosadmin (Catalogs). To use it, assign each business the wholesale types, vehicles and licenses you want.
Data created as you use it
| What | When |
|---|---|
| Orders board columns (New, In preparation, Delivered) | The first time a business opens the tablet, in the Config.Locale language. |
Delivery zones from Config.Delivery.seedPoints | First start, if the table is empty. |
| Street sales, wifi and vending licenses | When a business reaches their level. |
Businesses and recipes are created by you from the panel.
Tables
Businesses and levels
| Table | Stores |
|---|---|
comercios_businesses | Registered businesses: job, name, logo, type and current level. |
comercios_level_definitions | Levels for each business type (name and color). |
comercios_level_rules | Automatic requirements (metric and threshold). |
comercios_level_templates / comercios_level_overrides | Reward and requirement texts per type and per business. |
comercios_level_images / comercios_level_achievements | Level images and requirements ticked by hand. |
comercios_feature_flags | Enabled features, global and per business. |
comercios_permissions | Permissions for each rank in each business. |
Sales
| Table | Stores |
|---|---|
comercios_orders | Orders: products, total, discount, payment method and status, column, employee. |
comercios_kanban | Each business's board columns. |
comercios_products | Menu products and their options. |
comercios_services | Services. |
comercios_categories | Categories. |
comercios_convenios | Discounts and deals. |
comercios_invoices | Business invoices. |
Staff
| Table | Stores |
|---|---|
comercios_duty_log | Duty shifts (clock in and out). Feeds the days-open metric. |
comercios_activity_log | Activity history. |
comercios_primas | Bonuses paid to employees (for the weekly cap). |
comercios_application_form / comercios_applications | Application form and applications received. |
Premises and street
| Table | Stores |
|---|---|
comercios_puntos | Premises points, including the NPC seller and wifi. |
comercios_caja_props | Counter props. |
comercios_maintenance_nodes / comercios_maintenance_zones | Maintenance nodes and blackout perimeters. |
comercios_carts / comercios_cart_products | Carts and business vending machines, with their catalog. |
comercios_delivery_points | Delivery zones. |
Fleet, licenses and crafting
| Table | Stores |
|---|---|
comercios_vehicle_catalog / comercios_vehicle_catalog_offers | Vehicle catalog and which businesses it's offered to. |
comercios_vehicle_stock / comercios_vehicle_log | Purchased vehicles and their log. |
comercios_fines | Fleet fines. |
comercios_license_catalog / comercios_license_catalog_offers / comercios_licenses | License catalog, offers and purchased licenses. |
comercios_crafting_recipes / comercios_crafting_materials | Recipes and their materials. |
comercios_crafting_furnace / comercios_crafteo_slot_recipes | Oven state and recipes per point. |
Wholesale
| Table | Stores |
|---|---|
comercios_wholesale_types / comercios_wholesale_type_jobs | Wholesaler types and the businesses in each type. |
comercios_wholesale_catalog / comercios_wholesale_catalog_types / comercios_wholesale_jobs | Catalog, each item's types and special-price access. |
comercios_wholesale_npcs | Pick-up points. |
comercios_wholesale_orders / comercios_wholesale_history | Orders and history. |
comercios_granja_excedentes | Farm surplus sales to the wholesaler (Config.FarmSurplus, off by default). |
Other
| Table | Stores |
|---|---|
comercios_web_shops / comercios_web_items | Each business's web menu (the panel's Web menu tab), meant for an external website. |
comercios_migrations | Data files already applied. Don't delete it. |
The contents of storages, counters, lockers, carts and vending machines are saved by ox_inventory in its own tables, like any stash.
Backups
Before updating, save every script table:
mysqldump -u USER -p YOUR_DATABASE $(mysql -u USER -p -N -e "SHOW TABLES FROM YOUR_DATABASE LIKE 'comercios\_%'") > comercios-backup.sql
Or, more simply, back up the whole database.