?
avatar PhilETaylor
PhilETaylor
7 Dec 2016

Steps to reproduce the issue

Install from joomla-cms rev 2a375e3

Expected result

Database is up to date

Actual result

Table 'havxz_languages' should not have index 'idx_image'. (From file 3.7.0-2016-11-21.sql.)
Click Fix button
Table 'havxz_languages' does not have index 'idx_image'. (From file 3.7.0-2016-11-21.sql.)
Click Fix button
Table 'havxz_languages' should not have index 'idx_image'. (From file 3.7.0-2016-11-21.sql.)
Click Fix button
Table 'havxz_languages' does not have index 'idx_image'. (From file 3.7.0-2016-11-21.sql.)
Click Fix button
Table 'havxz_languages' should not have index 'idx_image'. (From file 3.7.0-2016-11-21.sql.)

System information (as much as possible)

https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-11-21.sql

https://gist.github.com/8432669637672974c903498a12efaf81

avatar PhilETaylor PhilETaylor - open - 7 Dec 2016
avatar joomla-cms-bot joomla-cms-bot - change - 7 Dec 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 Dec 2016
avatar Bakual
Bakual - comment - 7 Dec 2016

Might be related to #12949

avatar andrepereiradasilva
andrepereiradasilva - comment - 7 Dec 2016

Hum it seems the database schema checker does not take into account that a new index with the same name is created after.

this can be resolved if we change the new index name to, for instance, #__language_image.

ALTER TABLE `#__languages` DROP INDEX `idx_image`;
ALTER TABLE `#__languages` ADD INDEX `idx_language_image` (`image`);

But maybe there is another way, but i'm no db expert.
it would be nice to have @alikon option on this.

avatar sovainfo
sovainfo - comment - 8 Dec 2016

The DROP INDEX and ADD INDEX need to be in the same statement.

avatar andrepereiradasilva
andrepereiradasilva - comment - 8 Dec 2016

Yes, but how we do that in the 3 db system? Suggestions?

avatar brianteeman brianteeman - change - 8 Dec 2016
Status New Confirmed
avatar brianteeman brianteeman - edited - 8 Dec 2016
avatar alikon
alikon - comment - 8 Dec 2016

@andrepereiradasilva can you test adding a COMMIT; between the 2 ALTER statments ?

avatar andrepereiradasilva
andrepereiradasilva - comment - 8 Dec 2016

tested. doesn't work also.

avatar sovainfo
sovainfo - comment - 8 Dec 2016

ALTER TABLE #__languages DROP INDEX idx_image , ADD INDEX idx_image ;

Replace INDEX with CONSTRAINT for PG and MS SQL.
Obviously the names are different and these subcommands aren't recognized by schema checker.
They shouldn't cause the problems mentionedhere.

avatar andrepereiradasilva
andrepereiradasilva - comment - 8 Dec 2016

@sovainfo nice, tested in mysql and works. will make a PR

avatar andrepereiradasilva
andrepereiradasilva - comment - 8 Dec 2016

please test #13128

avatar Bakual Bakual - change - 8 Dec 2016
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2016-12-08 14:14:36
Closed_By Bakual
avatar Bakual Bakual - close - 8 Dec 2016
avatar Bakual
Bakual - comment - 8 Dec 2016

Closing as we have a PR.

Add a Comment

Login with GitHub to post a comment