A tool to fix data inconsistency problems described in blessing-skin-plugins#151.
Only MySQL is supported!
-
Clone the repository
git clone https://github.com/yushijinhun/bs-uuid-migration.git cd bs-uuid-migration
-
Install dependencies (Node.js is required)
npm install
-
Copy
config.js.example
toconfig.js
cp config.js.example config.js
-
Edit
config.js
to fill in the database URL, the site URL and the table prefix -
Block users' access to the website
User operations during the migration might corrupt the data, so you have to block access from other machines (eg. using iptables). The migration script needs to collect some data from the website API for integrity check, please make sure the machine running the script can still access the website.
-
Run the precheck script
npm run precheck
This command collects data and checks whether it's safe to perform migration. The collected data are saved in
results/
and cached. -
Run the migration script
npm run migrate
This command performs the migration. The migration will remove inconsistent records and add constraints to the table. The migrated data will be temporarily stored in the table
<prefix>_uuid_new
. After data is verified,<prefix>_uuid
will be renamed to<prefix>_uuid_old
, and<prefix>_uuid_new
will be renamed to<prefix>_uuid
.