Skip to content

Conversation

@richard67
Copy link
Member

@richard67 richard67 commented Jul 9, 2019

Pull Request for Issue #25482 .

Summary of Changes

Change back data type of column home to string (type depending on db type) in table #__template_styles, because it can not only hold values '0' or '1' but also language code, e.g. 'de-DE', if the template style is a default for a particular language.

This is an undo of PR #24595 .

Testing Instructions

4 different tests.

  1. Update Joomla 3.9.8 site to a patched 3.9.9 package with this PR and the version number patched to 3.10. PLEASE DO THIS ONLY ON TESTING SITE, NOT ON LIFE SITE.
    You can find such a package here:
    https://test5.richard-fath.de/Joomla_3.9.10-dev-Update_Package_pr-25484.zip.

  2. Do the same with a 3.9.9: Update it to my patched package.

  3. On a 3.9.8, apply this PR e.g. with patch tester, then go to "Extensions -> Manage -> Database". Use the "Fix" button to apply the changes in the new schema updates from this PR.

  4. Do the same as in step 3 but on a 3.9.9

Expected result

In all cases the update or schema fix succeeds, and issue #25482 is solved.

Actual result

See issue #25482 .

Documentation Changes Required

None.

@mbabker
Copy link
Contributor

mbabker commented Jul 9, 2019

For the record, the fact you have to rename the index is exactly why the bug in the schema parser needs to be fixed. You should not have to version suffix table indexes.

@richard67
Copy link
Member Author

@mbabker Yes, I know. But it is not a bug, it is missing by design. That's why I did not fix it yet, it is a bigger thing.

@richard67
Copy link
Member Author

Attention, PR is not ready yet, changes in joomla.sql are missing. But you can already apply the PR and run the DB fixer for testing the schema updates are working.

@mbabker
Copy link
Contributor

mbabker commented Jul 9, 2019

It's a bug if it's missing this critical of a feature 😉

(And yeah, I realize fixing the database code is a lot more effort than it's sometimes worth, but still have to make it known I hate hacky fixes to work around a deeper underlying problem)

@HLeithner
Copy link
Member

ALTER TABLE #__template_styles DROP INDEX idx_client_id_home; may fail because the index doesn't exists on direct update

@richard67
Copy link
Member Author

@mbabker I absolutely agree with you about the issue, but it is not just a bug fix. It needs a redesign of the schema checker. That's why we now have to use the ugly hacks, we don't have the time now to fix the schema checker.

@richard67
Copy link
Member Author

@HLeithner Not sure. For postgres I have used "IF EXISTS", that should be ok. For the other DB types we don't have that yet. I have to check that.

@richard67
Copy link
Member Author

Hint for testers: Link to modified update package in description has changed, package has been updated by latest changes on this PR.

@simbus82
Copy link
Contributor

simbus82 commented Jul 9, 2019

@HLeithner Not sure. For postgres I have used "IF EXISTS", that should be ok. For the other DB types we don't have that yet. I have to check that.

Something like this for MySQL can help?
(only some new versions of mysql like MariaDB supports IF EXIST for indexes)

SET @idxexist := (SELECT COUNT(*) FROM information_schema.statistics WHERE table_name = '#__template_styles' AND index_name = 'idx_client_id_home' AND table_schema = database());
SET @sqlrmidx:= if( @idxexist > 0, 'SELECT ''INFO: Index already exists.''', 'ALTER TABLE #__template_styles DROP INDEX idx_client_id_home');
PREPARE rmidx FROM @sqlrmidx;
EXECUTE rmidx;

@richard67
Copy link
Member Author

@simbus82 That would work for the installer when doing the update, but the database schema checker would be confused. we found other way. pr is ready for being tested.

@richard67
Copy link
Member Author

@alikon @twister65 Can you test this PR for postgres? I gotta go sleep now.

@wilsonge
Copy link
Contributor

I have tested this item ✅ successfully on 71252b7

On a mariadb setup this worked for me on the downloads.joomla.org backup I have (which experienced this issue) going from both 3.9.8 backup to this proposed 3.9.10 directly and also going from 3.9.8 to 3.9.9 and then to the proposed 3.9.10. In both cases the schema checker also didn't show any issues.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25484.

@alikon
Copy link
Contributor

alikon commented Jul 10, 2019

not able to do a full test on postgresql ... just a quick test on SQL Fiddle
Cattura1

@infograf768
Copy link
Member

I have tested this item ✅ successfully on 71252b7

This corrects the issue here with mysqli


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25484.

@ghost
Copy link

ghost commented Jul 10, 2019

Status "Ready To Commit".

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jul 10, 2019
@wilsonge
Copy link
Contributor

@alikon not good enough for a postgresql test for this I'm afraid. We need to be sure our index's are being preserved. Anyone else here able to do a postgresql test before this is merged

@ghost ghost removed the RTC This Pull Request is Ready To Commit label Jul 10, 2019
@ghost
Copy link

ghost commented Jul 10, 2019

Set back on pending by comment of @wilsonge above.

@alikon
Copy link
Contributor

alikon commented Jul 10, 2019

i know, but cannot help today more than this ...

@wilsonge
Copy link
Contributor

https://docs.joomla.org/Tables/template_styles i've updated this page to state it's a varchar and noted the type of the database

@wilsonge
Copy link
Contributor

wilsonge commented Jul 10, 2019

@alikon are you able to at least test it with the index's applied to that table rather than just with the table structure? I installed postgres with brew last night onto my macbook but didn't get time to set up a full joomla install - and won't be able to until tonight

@alikon
Copy link
Contributor

alikon commented Jul 10, 2019

sorry @wilsonge & all, i'm able to do only some spot SQL Fiddle

Cattura2

@HLeithner
Copy link
Member

I tested all postgresql scenarios with postgresql 9.6 and worked now.

thx richard

@HLeithner HLeithner merged commit 6b92cc3 into joomla:staging Jul 10, 2019
@richard67 richard67 deleted the staging-correct-template-styles-home branch July 10, 2019 16:26
twister65 added a commit to twister65/joomla-cms that referenced this pull request Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants