Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change back data type of template styles home column in db #25484

Merged

Conversation

Projects
None yet
9 participants
@richard67
Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Contributor Author

commented Jul 9, 2019

@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

This comment has been minimized.

Copy link
Contributor Author

commented Jul 9, 2019

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

commented Jul 9, 2019

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

@richard67

This comment has been minimized.

Copy link
Contributor Author

commented Jul 9, 2019

@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

This comment has been minimized.

Copy link
Contributor Author

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.

richard67 added some commits Jul 9, 2019

@richard67

This comment has been minimized.

Copy link
Contributor Author

commented Jul 9, 2019

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

@simbus82

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Contributor Author

commented Jul 9, 2019

@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

This comment has been minimized.

Copy link
Contributor Author

commented Jul 9, 2019

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

@wilsonge

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

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

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

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

@infograf768

This comment has been minimized.

Copy link
Member

commented Jul 10, 2019

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.

@franz-wohlkoenig

This comment has been minimized.

Copy link
Member

commented Jul 10, 2019

Status "Ready To Commit".

@joomla-cms-bot joomla-cms-bot added the RTC label Jul 10, 2019

@wilsonge

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

@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

@franz-wohlkoenig franz-wohlkoenig removed the RTC label Jul 10, 2019

@franz-wohlkoenig

This comment has been minimized.

Copy link
Member

commented Jul 10, 2019

Set back on pending by comment of @wilsonge above.

@alikon

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

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

@wilsonge

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

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

Cattura2

@HLeithner

This comment has been minimized.

Copy link
Member

commented Jul 10, 2019

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

4 checks passed

Hound No violations found. Woof!
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/drone/pr Build is passing
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@richard67 richard67 deleted the richard67:staging-correct-template-styles-home branch Jul 10, 2019

twister65 added a commit to twister65/joomla-cms that referenced this pull request Jul 10, 2019

wilsonge added a commit that referenced this pull request Jul 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.