Migration from nc-banking V1 to V2

Not recommended for most servers.

The safest way to use nc-banking V2 is as a fresh install on a new server or
with a clean database. This page is only for advanced users who must keep
existing V1 player data.


Should you migrate?

Before doing anything, decide if you really need migration.

  • Recommended

    • New server or wipe is acceptable.
    • You can afford to reset banking data (accounts, loans, invoices, cards).
    • → Use V2 as a fresh install and ignore this page.
  • Migration (not recommended)

    • You already run nc-banking 1.0.4 in production.
    • You have important live data (balances, loans, invoices) you cannot wipe.
    • You understand SQL backups and can restore your DB if anything goes wrong.

If you are not comfortable restoring backups, do not attempt migration.


What changes between V1 and V2?

Resource structure

Comparing resources/nc-banking104 (V1) with resources/nc-banking (V2):

  • V1 (1.0.4)

    • Client scripts:
      • client/main.lua
      • client/atm_spawn.lua
      • client/billing.lua
      • client/atm_calibration.lua
    • Server scripts:
      • server/main.lua
      • server/discord.lua
      • server/version.lua
    • UI:
      • html/index.html (bank UI)
      • html/billing.html (billing app)
    • Config/DB:
      • config/config.lua (V1 options only)
      • sql/install.sql (core banking tables)
  • V2 (2.0.0) adds on top of that:

    • Client scripts:
      • client/banking_job.lua — banking job + branch owner logic
      • client/tablet.lua — teller tablet NUI bridge
      • client/tablet_calibration.lua — tablet camera/calibration
    • Server scripts:
      • server/banking_job.lua — branches, vaults, employees, fees
    • UI / assets:
      • html/tablet.html — teller tablet & owner dashboard UI
      • tablet_screen.json — tablet calibration data
      • web/ — NUI source (for development, not required in production)
    • Config:
      • Config.BankingJob and related V2 options in config/config.lua.

Database schema

Both V1 and V2 share the same core tables, defined in sql/install.sql:

  • nc_banking_accounts
  • nc_banking_transactions
  • nc_banking_savings
  • nc_banking_loans
  • nc_banking_invoices
  • nc_banking_savings_goals
  • nc_banking_interest_history
  • nc_banking_personal
  • nc_banking_business
  • nc_banking_shared
  • nc_banking_shared_members
  • nc_banking_atms
  • nc_banking_cards

V2 adds branch-related tables at runtime from server/banking_job.lua (not in install.sql):

  • nc_banking_branch_ownership
  • nc_banking_branch_employees
  • nc_banking_branch_labels
  • nc_banking_branch_vaults
  • nc_banking_branch_vault_logs
  • nc_banking_branch_fees
  • nc_banking_branch_zones
  • plus an extra branch_id column on nc_banking_atms

On first start, V2 will:

  • Create the new branch tables if they do not exist.
  • Add branch_id column to nc_banking_atms if it is missing.
  • Leave all existing V1 data (accounts, loans, invoices, etc.) as-is.

Because of this, a V1 → V2 migration is mostly about replacing the resource while
keeping the existing database.


High-level migration plan

  1. Prepare and test on a copy of your server if possible.
  2. Take full backups (DB + resource).
  3. Replace V1 nc-banking with V2 nc-banking.
  4. Merge your config/config.lua changes carefully.
  5. Start the server once, let V2 create new tables/columns.
  6. Decide if you enable the banking job & branches now or later.
  7. Test core banking features and only then expose V2 features to players.

Step 1: Backup everything

Do not skip this step.

  1. Database backup

    • Dump your entire database, or at minimum all tables that start with
      nc_banking_.
    • Example (MySQL CLI):
      mysqldump -u user -p your_database nc_banking_accounts nc_banking_transactions ... > nc_banking_backup.sql
      
  2. Resource backup

    • Copy the whole V1 resource folder somewhere safe:
      resources/nc-banking104/      # keep as reference
      resources/nc-banking/         # current live V1, will become V2
      
    • Or simply zip resources/nc-banking and store it.

Step 2: Replace the resource

  1. Stop your server, or at least stop the nc-banking resource.
  2. Replace the live resource:
    • Delete or move the existing resources/nc-banking (V1) out of the
      resources folder.
    • Copy the new V2 nc-banking folder into resources.
  3. Confirm the manifest:
    • V2 fxmanifest.lua should show version '2.0.0'.
    • Client scripts list should include client/banking_job.lua and client/tablet.lua.
    • Server scripts list should include server/banking_job.lua.

Your V1 folder resources/nc-banking104 can stay as a reference only; it is
not used by the server.


Step 3: Merge configuration changes

The config file changed between V1 and V2, especially for:

  • New ATM fee behaviour and confirmations
  • Banking job & branches (Config.BankingJob)
  • Owner dashboard and tablet settings

Recommended approach

  1. Open V2 config/config.lua (fresh file from new resource).
  2. Open your old V1 config/config.lua (from nc-banking104).
  3. Manually copy your custom values from V1 into the V2 file:
    • Framework / locale / inventory / target settings
    • Custom minimum amounts, limits, interest, etc.
    • Any integration flags you changed.
  4. Leave new V2 sections (like Config.BankingJob) intact unless you really
    know what you are doing.

Banking job toggle

  • To delay using the banking job/branches and keep behaviour close to V1:
    Config.BankingJob.enabled = false
    
  • To start using the job/branches after migration:
    Config.BankingJob.enabled = true
    

You can migrate with enabled = false first, verify that all player data and
basic banking still works, then enable the job later.


Step 4: First start on V2

  1. Ensure in config/config.lua:
    Config.AutoInstallSQL = true
    
  2. Start the server (or ensure nc-banking).
  3. Watch the console:
    • The usual nc-banking tables should be detected as existing.
    • New tables (branch ownership, employees, vaults, fees, zones) should be
      created automatically.
    • nc_banking_atms should be altered to add branch_id if it was missing.

If you see any SQL errors, stop the server immediately and restore your
backup before trying again.

After a successful start, you may set Config.AutoInstallSQL = false again if
you prefer.


Step 5: Post-migration checks

Before letting players back in, verify:

  • Player accounts
    • Use your admin tools to check a few players:
      • Balances look correct.
      • Savings, personal, business, shared accounts still exist.
  • Transactions & loans
    • Open the bank and ATM UIs to make sure:
      • Transaction history loads.
      • Existing loans show correctly.
  • Invoices
    • Check that pending invoices are visible and payable.
  • Cards
    • Existing cards still work (if you used the card system in V1).

Only after these pass should you:

  • Enable Config.BankingJob.enabled = true (if you plan to).
  • Start testing branch purchase, owner dashboard, teller tablet.

When to roll back

Immediately restore your backup and return to V1 if:

  • Core tables are corrupted or missing data.
  • Players report missing balances or accounts.
  • SQL errors occur repeatedly on every start.

Because V2 alters the nc_banking_atms table and creates new tables, rolling
back is easiest if you restore the full DB dump and the old nc-banking
resource together.


Summary

  • For new servers or wipes, use V2 as a fresh install and ignore V1
    migration entirely.
  • For live servers that must keep V1 data, migration is possible but not
    officially recommended
    .
  • Always:
    • Back up your DB and resource.
    • Test on a copy first if you can.
    • Keep nc-banking104 as a reference only; production should run only one
      nc-banking resource (the V2 one).
Last updated 1 month ago