Standalone Python tool for migrating TNE shared/non-player accounts into EconomyPol.
Behavior:
- reads all runtime settings from
migration.yml - writes a human-readable
migration.log - supports
inspect,dry_run, andapply - bootstraps the target EconomyPol schema from the bundled
schema/V1__init.sqlduringapply - migrates shared accounts only
- preserves shared account names, owner UUID metadata, balances, and member existence
rn- ignores legacy TNE shared-account rows whoseusernamecontainsexpired - intentionally discards TNE per-member permission detail because EconomyPol no longer stores it
Dependencies are listed in requirements.txt.
Entrypoint:
python migrate.pyThe tool expects migration.yml to live next to migrate.py. A sample config is provided in migration.yml.example.
Configuration notes:
- the tool builds the SQLAlchemy connection URL for you
- set
host,port,database,user, andpasswordfor bothsourceandtarget hostmay be an IP address or hostname
inspect is a read-only preflight mode.
It:
- validates the source and target database connections
- checks that the required TNE tables exist
- lists the available TNE currencies
- reads shared accounts, region totals, balances, and member-permission rows
- builds the migration plan
- validates the target preflight conditions if the EconomyPol schema is already present
- writes the findings to
migration.log
It does not write anything to the EconomyPol database.
If the EconomyPol schema is not present yet, inspect logs that apply would create it from the bundled schema/V1__init.sql.
dry_run does everything inspect does, plus writes the full planned migration actions to migration.log.
That includes:
- the shared accounts that would be inserted
- the floored target balances
- the member relationships that would be imported
- the warnings for skipped or downgraded permission data
- whether the target schema would need to be bootstrapped first
It does not write anything to the EconomyPol database.
apply performs the real migration.
It:
- reruns the same validation and planning work as
dry_run - creates the EconomyPol schema from the bundled
schema/V1__init.sqlif the target tables do not already exist - opens a target transaction
- inserts any missing referenced player rows into
economy_players - inserts shared accounts into
economy_accounts - inserts balances into
economy_balances - inserts deduplicated member relationships into
economy_account_members - writes the applied results and insert counts to
migration.log
If validation fails before the write step, nothing is imported.