# Migrating from v1

{% hint style="info" %}
This guide is only useful if you are looking to retain all the data from your v1 installation. If you want to start from scratch with v2, follow the installation guide to install it from scratch.
{% endhint %}

{% hint style="danger" %}
**Back up everything before you start!** Dealerships v2 is new, and there is a risk you could lose your existing data. Back up your existing database table, and your previous working version of JG Dealerships v1.
{% endhint %}

This guide walks you through upgrading from JG Dealerships v1 to v2 while preserving your existing data.

### Before You Begin

{% hint style="warning" %}
**Important:** Back up your existing `config.lua` file before proceeding. You will need it later.
{% endhint %}

{% stepper %}
{% step %}

### Replace Script Files

1. Delete all existing files in your `jg-dealerships` folder
2. Extract the new v2 files downloaded from Portal into the folder
3. Copy your backed-up `config.lua` into `config/config.lua`, replacing the new one
   {% endstep %}

{% step %}

### Add New Configuration Options

Add the following new v2 options to the bottom of your `config.lua`:

```lua
Config.UseFrameworkJobs = false
Config.InteractionMethod = "textui" -- or "target", "3dtextui", "radial"
Config.Target = "auto" -- or "ox_target"
Config.DrawText3d = "auto" -- or "sleepless_interact"
Config.RadialMenu = "auto" -- or "ox_lib"
Config.BlipNameFormat = "Dealership: %s"
Config.EntityStreamingDistance = 100.0 -- Distance in meters at which entities despawn/respawn
Config.TruckingMissionForOrderDeliveries = true
Config.DealershipMaxActiveTestDrives = 5 -- Maximum number of active test drives per dealership
Config.EmployeePermissions = {
  ["Manager"] = {
    "ADMIN", -- Full access
  },
  ["Supervisor"] = {
    "MANAGE_INVENTORY",
    "VIEW_RECORDS",
    "SELL",
    "DELIVER",
  },
  ["Sales"] = {
    "SELL",
    "VIEW_RECORDS",
    "DELIVER",
  },
}
```

{% endstep %}

{% step %}

### Restart and Migrate Database

1. Fully restart your server
2. Run the migration command using **one** of these methods:
   * Type `/migratev2` in the in-game chat
   * Run `migratev2` in the txAdmin server console
     {% endstep %}

{% step %}

### Import Your Locations

1. Navigate to `/dealeradmin` in-game
2. Click the **Import** button
3. Select **"Existing Config"** (described as: *Import locations from your config.lua (for v1 migration)*)
4. Follow the import wizard to complete the process
   {% endstep %}
   {% endstepper %}

### Done!

Your v1 data should now be migrated to v2. Verify your dealership locations & and check all functionality is working as expected.
