Browse docs

Shops

Install Sky Shops and migrate existing shop locations into the database.

Installation

The database storage and automatic legacy-file migration described here are available from 1.0.11.

Install current sky_base, select oxmysql in its configuration, and start the database, framework and other configured integrations first:

server.cfg
ensure sky_base
ensure sky_shops

Shops creates its tables automatically through Sky.DB.Migrate. You do not need to import import.sql manually or grant add_filesystem_permission sky_base write sky_shops. The database user needs permission to create and alter tables and to read and write their data.

Updating an existing installation

  1. Stop sky_shops. Back up its database tables and the existing data/shops.json.
  2. Replace the resource files, including fxmanifest.lua, the complete source folder and config/shop_locations.lua. Restore your old data/shops.json before the first start.
  3. Start the resource and check for [sky_shops] Legacy data migration complete in the console.
  4. Keep the old file as a backup. Later restarts load the database and do not import it again.

All saved shop entries are imported in their original order, including shop types, positions, NPC positions and headings. An invalid file or failed database transaction prevents startup without deleting the original file or committing part of the import. Fix the reported problem and restart. The tables must use InnoDB. Do not delete migration markers to repeat an import.

Configuration and new shops

Configure shop types, items, prices and interactions in config/config.lua. On a fresh database without an old data/shops.json, the initial locations come from config/shop_locations.lua. Changing that file later does not overwrite database locations.

Use the administrator command /createshop and select a shop type to save a new shop at your current position. The shop is shown to players only after it has been saved in the database.