What should I do if during the Ministra TV Platform update to version 5.6 I receive a Migrations run failed message?
During the update of Ministra TV Platform to version 5.6, you may encounter a Migrations run failed error while executing the phing command:
BUILD FAILED /var/www/stalker_portal/deploy/build.xml:357:12: /var/www/stalker_portal/deploy/build.xml:363:51: Migrations run failed
This error may be related to:
- Manual modification of the stalker_db database structure
or
- The presence in the stb_in_group table of entries with the same user identifiers (uid). In this case, in the phing command execution report, you find only one error among the results of the Ministra DB Migrations query:
CREATE UNIQUE INDEX uid_idx ON stb_in_group (uid) Migration 20190805112404 failed during Execution. Error An exception occurred while executing 'CREATE UNIQUE INDEX uid_idx ON stb_in_group (uid)
In previous versions of the portal, duplicate entries occurred when the User was moved from one user group to another.
During the move, a new record was created in the stb_in_group table, but the old one was not deleted. Therefore, a copy of the User was created in the same group or another group.
To fix the duplicate entries error:
- In the stb_in_group table, manually remove duplicates so that the uid column contains only unique values. You can only have one record with the same uid (even in different groups).
Or
- Use the script, proposed below, to clear the table.
Note! Before manually deleting entries, ensure that the User belongs to the correct group.
Please backup the stb_in_group table in the stalker_db database before doing any database manipulation:
mysqldump -u stalker -p1 stalker_db stb_in_group > /opt/stb_in_group_backup.sql
After executing the script, duplicate entries with the same uid are deleted from the stb_in_group table. At the same time, records with an id greater than that of the duplicate are saved.
wget -O /opt/fix_duplicates_stb_in_group.sql https://wiki.infomir.eu/wiki/en:article/files/133049960/133049959/1/1565184835000/fix_duplicates_stb_in_group.sql
2. Run the following command:
mysql -u stalker -p1 stalker_db < /opt/fix_duplicates_stb_in_group.sql
where stalker - database username, mysql_user parameter in custom.ini (config.ini);
1 - database user password, mysql_pass parameter in custom.ini (config.ini);
stalker_db - Ministra TV Platform database name, db_name parameter in custom.ini (config.ini);
fix_duplicates_stb_in_group.sql - file with fix.