Data Migration
Data migration refers to the process of migrating data from one system or database to another system or database. Data migration is an important part of data management and can be used in scenarios such as data backup, data recovery, data integration, and data migration.
Here, data migration refers to migrating the specified lower-version data in LOICollectionA to the corresponding higher version of LOICollectionA.
WARNING
Before data migration, please make sure Python 3.10.0 or above is properly installed and the server is configured
For upgrading from version 1.4.6 to version 1.4.7
- Download the
migrate147.pyfile and place it in thepluginroot directory - After that, run
python migrate147.pyin the command line to complete the migration - After the migration is complete, the new
settings.dbfile will contain all the migrated data
For upgrading from version 1.6.1 to version 1.6.2
- Download the
migrate162.pyfile and place it in thepluginroot directory - After that, run
python migrate162.pyin the command line to complete the migration - After the migration is complete, the new
settings.dbfile will contain all the migrated data
For upgrading from version 1.6.5 to version 1.7.0
- Download the
migrate170.pyfile and place it in thepluginroot directory - After that, run
python migrate170.pyin the command line to complete the migration - After the migration is complete, all module data will be migrated
For upgrading from version 1.9.2 to version 1.10.0
- Download the
migrate1100.pyfile and place it in thepluginroot directory - After that, run
python migrate1100.pyin the command line to complete the migration - After the migration is complete, all module data will be migrated
For upgrading from version 1.14.0 to version 1.15.0
WARNING
1.15.0 no longer provides automatic migration scripts. The interface data of Menu and Shop needs to be migrated manually.
- Before upgrading, please back up
config.json,menu.json, andshop.jsonin theplugins/LOICollectionA/configdirectory. - After the upgrade, Menu and Shop no longer read
menu.json/shop.json. Please refer to the examples in Data Files to manually rewrite the old data asmenu.lcuiandshop.lcui, and place them in theplugins/LOICollectionA/configdirectory. The examples already declare their variables withlet; if you wrote the scripts from older examples, addletbefore upgrading to 1.17.0 — see below. - If you have customized
GuiPath, please confirm thatServerConfig.Plugins.Menu.GuiPathandServerConfig.Plugins.Shop.GuiPathinconfig.jsonpoint to the newly created lcui files (defaulting tomenu.lcuiandshop.lcuirespectively). - The data files of other modules (such as
notice.jsonandcdk.json) and database files are not affected; the interfaces of other modules are now loaded from the plugin's built-inguidirectory and do not need migration.
For upgrading from version 1.15.1 to version 1.16.0
WARNING
1.16.0 introduces a script sandbox and authorization mechanism. Earlier versions had no permission.json, and scripts could freely run mc::runCmd, read and write GUI data, and navigate to other scripts. After upgrading these calls are denied by default, so scripts you wrote (such as menu.lcui / shop.lcui) must be granted authorization to keep working.
permission.jsonis a new file in 1.16.0, located inplugins/LOICollectionA/gui/, with a deny-by-default policy (defaultPolicy: "deny"). It governsmc::runCmd,GUIManager::value/request/callback, and cross-script navigation viaGUIManager::open. Authorization for built-in scripts (blacklist,wallet, etc.) ships with the plugin and needs no action.If your
menu.lcui/shop.lcuiinvokes any of the above, fill in the allowlists underscripts.menu/scripts.shopbased on what the script actually calls: commands go incommands.templates(withcommands.allowset totrue), data ids go ingui.values/gui.requests/gui.callbacks.If the script contains cross-script navigation such as
GUIManager::open("<other script id>", ...), also declare the target ingui.navigations, for example:json"menu": { "enabled": true, "commands": { "allow": true, "templates": [] }, "gui": { "values": [], "requests": [], "callbacks": [], "navigations": ["wallet", "market"] } }Opening a script's own form (
GUIManager::open("wallet", ...)insidewallet) is unaffected and needs no grant.1.16.0 also introduces a bytecode cache: compiled scripts are stored next to the source as
.lcpand reused on later starts to skip compilation. The plugin generates and invalidates it automatically; deleting one only causes a recompile on the next start and does not affect correctness.If the log shows
is not allowed for scriptafter upgrading, a capability is missing its grant — add the script id from the message to the matching allowlist.
For upgrading from version 1.16.0 to version 1.17.0
WARNING
1.17.0 replaces the data layer with block storage (BlockRepository + TypedTable, see Architecture Overview). The plugin does not replay old data automatically at start-up: tables written by older versions are no longer read, so you must either run the migration script by hand or re-enter the data yourself.
Back up the whole
plugins/LOICollectionA/datadirectory (andconfig,gui) before upgrading.Download
scripts/migrate/migrate_block.pyand put it in the plugin root directory (the parent ofplugins/LOICollectionA/, where the script looks for the database files by default).Run a dry run first to confirm which tables and how many rows will be migrated:
bashpython migrate_block.py --data-dir plugins/LOICollectionA/data --dry-runOnce the output looks right, drop
--dry-runto perform the migration for real:bashpython migrate_block.py --data-dir plugins/LOICollectionA/dataThe script rewrites the legacy
SQLiteStoragekey/value tables in place into the block model'sblock/prop/link/metastructure, routing by file: tables inblacklist.db,mute.db,tpa.db,chat.dbandmarket.dbare migrated inside their own file, while tables registered against the sharedSettingsDBservice (Market,MarketTax,Language,Pvp,Chat,Tpa,Wallet, and their siblings) are migrated insidesettings.db. Every domain column is preserved; thecol_<rootId>side table and theschema:/sidecol:fingerprints are rebuilt by the plugin the first time it opens the database.Two legacy tables are intentionally not migrated:
Notice(the current build stores notices as JSON, not SQLite) andLanguageinsidestatistics.db(the current code only reads theLanguagetable insettings.db, which is the authoritative copy). Both are left untouched on disk.If you prefer not to use the script, you can migrate manually instead: on the first start after upgrading, the plugin creates the block-model system tables (
dict/block/prop/link/meta) in every.dbfile and then runs on empty data.Without a migration your old data is still not deleted — it stays in the legacy tables of each database file (tables named after the feature, such as
Wallet,Blacklist,Market). To keep it, export those tables with a SQLite tool and re-enter the data through the in-game UI or commands.notice.json,cdk.jsonandconfig.jsonremain plain JSON files and are unaffected — no migration needed.Scripts you wrote yourself (
config/menu.lcui,config/shop.lcui, and any script you edited undergui) are usually copies of older examples and therefore use keyword-less bare assignments. Every variable binding must be declared withlet; a bare assignment no longer creates a variable, so such a script fails to load withVariable 'xxx' is not declared; write 'let xxx = ...' to introduce itand is not enabled (the start-up log shows it atERROR [LOICollectionA]level). Addletto the first assignment of every variable:lcui// before the upgrade button1 = new MenuItemData(); form = new MenuForm("main", "Menu Example"); // after the upgrade let button1 = new MenuItemData(); let form = new MenuForm("main", "Menu Example");Only the first binding needs
let: later re-assignments (button1.permission = 0;), member writes (form.button(...)) and index writes stay as they are; a typed declaration is writtenlet x: int = 0;and must provide an initial value. There is no need to delete the.lcpcache by hand after editing a script — the plugin invalidates it from the source content and recompiles. See entries 59 and 60 of Error Handling for this class of error.
TIP
If the history does not matter, you can delete the .db files under plugins/LOICollectionA/data and let the plugin rebuild empty databases — back them up first.