? Pending

User tests: Successful: Unsuccessful:

avatar richard67
richard67
15 Sep 2018

Pull Request for new issue.

Summary of Changes

Add new column state to table #__privacy_consents at the same place as with a new installation in schema update for mysql.

Testing Instructions

Code review: Check the position of column state in the CREATE TABLE statement for table #__privacy_consents in the installation sql for mysql. Check that the changes of this PR correct the schema update so it adds the column at the same place.

See here:

https://github.com/joomla/joomla-cms/blob/staging/installation/sql/mysql/joomla.sql#L1702.

Verify also that there are already schema updates for mysql which use the "AFTER" clause when adding new columns, e.g. 2.5.0-2011-12-06.sql, 2.5.0-2012-01-10.sql, ..., 3.8.0-2017-07-28.sql, so you can see this PR adds nothing new regarding that.

Or real life test: Using MySQL database, install a new 3.9-beta2-dev (nightly build from today) on one site, install a 3.8.12 on another site and then update that site to nightly build from today. Then export both databases in sql and compare the sql files regarding table structures.

Expected result

Code review: Column state of table #__privacy_consents will be added at the right place by the schema update with this PR.

Real life test: Column state of table #__privacy_consents is at the same place on both sites.

Actual result

On a new installation, the column state of table #__privacy_consents comes after column user_id, while on an updated 3.8.12 it comes at the end of the table.

Documentation Changes Required

None.

avatar richard67 richard67 - open - 15 Sep 2018
avatar richard67 richard67 - change - 15 Sep 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 15 Sep 2018
Category SQL Administration com_admin
avatar richard67 richard67 - change - 15 Sep 2018
Title
Correct mysql/3.9.0-2018-08-12.sql
Correct position of column "state" in table "#__privacy_consents" in file "mysql/3.9.0-2018-08-12.sql"
avatar richard67 richard67 - edited - 15 Sep 2018
avatar richard67
richard67 - comment - 15 Sep 2018

@alikon @SharkyKZ Can you check this PR here, too?

avatar alikon
alikon - comment - 16 Sep 2018

The order of columns is not relevant in a relational database,
the AFTER clause is mysql only iirc, therefore maybe is better to change the install order instead

avatar richard67
richard67 - comment - 16 Sep 2018

@alikon This PR handles only a mysql file so the AFTER clause is OK here. That order of columns is not relevant in a relational database I know pretty well, but as long as we can keep it consistent we should do it.

avatar richard67
richard67 - comment - 16 Sep 2018

@alikon P.S.: Other schema updates for mysql use already the AFTER clause.

avatar richard67 richard67 - change - 16 Sep 2018
The description was changed
avatar richard67 richard67 - edited - 16 Sep 2018
avatar richard67 richard67 - change - 16 Sep 2018
The description was changed
avatar richard67 richard67 - edited - 16 Sep 2018
avatar richard67 richard67 - change - 16 Sep 2018
The description was changed
avatar richard67 richard67 - edited - 16 Sep 2018
avatar richard67
richard67 - comment - 16 Sep 2018

@alikon I've updated testing instructions to make more clear that this PR is for mysql and that the AFTER clause is nothing new for mysql schema updates.

avatar richard67 richard67 - change - 16 Sep 2018
The description was changed
avatar richard67 richard67 - edited - 16 Sep 2018
avatar alikon
alikon - comment - 16 Sep 2018

in this way we have a mysql table DDL for that table different from the DDL of the same table in mssql & postgresql, again column order is not important in relational databases, but having the same column ordering
for the same table cross different databases is more consistent

avatar richard67
richard67 - comment - 16 Sep 2018

@alikon I only did it in the same way as it is done already with all the other schema updates in mysql: They make order in updated mysql consistent with order in new installed mysql. There never was consistency between updated mysql and updated postgresql. If it was not already this way, I would never have made this PR here. Please check that and you will see I am right.

avatar richard67 richard67 - change - 16 Sep 2018
Title
Correct position of column "state" in table "#__privacy_consents" in file "mysql/3.9.0-2018-08-12.sql"
[mysql] Correct position of column "state" in table "#__privacy_consents" in file "3.9.0-2018-08-12.sql"
avatar richard67 richard67 - edited - 16 Sep 2018
avatar alikon
alikon - comment - 16 Sep 2018

this not mean, that we are doing it in a consistent/correct way, imho we were wrong even in the past

avatar richard67
richard67 - comment - 16 Sep 2018

@alikon It seems we are both right: If you change directory to folder "administrator/components/com_admin/sql/updates/mysql" and then on a Windows command shell do a findstr /i /c:"add column" *.sql or on a Linux shell do a grep -i "add column" *.sql, you will see that some 30 or 40 % of the statements use the "AFTER" clause and the others not. And so we are not really doing it in a consistent way, so or so.


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

avatar richard67
richard67 - comment - 16 Sep 2018

I leave this PR open for a while to see if there are other opinions about what is desired:

  • Consistency between updated mysql and new installed mysql by always using "BEFORE" or "AFTER" with every "ADD COLUMN" statement in mysql schema updates, and not having consitency between updated mysql and updated other databases, or
  • consistency between updated mysql and updated other database types by never using "BEFORE" or "AFTER" with any "ADD COLUMN" statement in mysql schema updates and keeping schema updates for all databases consistent regarding the order of "ADD COLUMN" statements over all schema updates (I think I remember this was never 100 % fulfilled in past and so this consistency can not be 100% granted from my point of view), and not having consistency between updated database and new installed database of same type
avatar SharkyKZ
SharkyKZ - comment - 16 Sep 2018

AFTER is always used in MySQL files unless column is being at the end of the table. I'm not particularly familiar with other databases but quick search tells me they don't support this. Their loss.

avatar SharkyKZ
SharkyKZ - comment - 16 Sep 2018

I have tested this item successfully on 3aa666d


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

avatar SharkyKZ SharkyKZ - test_item - 16 Sep 2018 - Tested successfully
avatar richard67
richard67 - comment - 16 Sep 2018

Thanks @SharkyKZ . That confirms my finding.


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

avatar alikon
alikon - comment - 16 Sep 2018

...we have always done this way....
never fight against windmills ? ?

avatar richard67
richard67 - comment - 16 Sep 2018

Windmills? I always thought it was giants ;-)

avatar alikon
alikon - comment - 16 Sep 2018

https://en.wikipedia.org/wiki/Tilting_at_windmills
sorry i'm italian
so it's quite hard to translate from italian -> to english -> to whatever ... maybe klingon?

avatar richard67
richard67 - comment - 16 Sep 2018

Don Quixote was fighting against imaginary giants which in fact were windmills, that's what I referred to, too.

avatar richard67
richard67 - comment - 16 Sep 2018

Maybe I should not try to make jokes in English.

avatar alikon
alikon - comment - 16 Sep 2018

no problem at all, i'm always open to understand different sense of humor ?

avatar SharkyKZ
SharkyKZ - comment - 17 Sep 2018

This is purely about consistency.

avatar richard67
richard67 - comment - 19 Sep 2018

@mbabker Thanks for review. Unfortunately it seems to be hard to get a 2nd tester so it did not go into beta 2. Do you think you can test so it becomes RTC? It should definitely go into final release and so should be merged before release candidate.

avatar alikon
alikon - comment - 19 Sep 2018

I have tested this item successfully on 3aa666d


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

avatar alikon alikon - test_item - 19 Sep 2018 - Tested successfully
avatar richard67
richard67 - comment - 19 Sep 2018

Finally.

avatar alikon
alikon - comment - 19 Sep 2018

so we have 2 tests now RTC

p.s.
i still think that this is not so consistent/correct by with 0.001 % of no-mysql users....

ubi major minor cessat ?

avatar Quy Quy - change - 19 Sep 2018
Status Pending Ready to Commit
avatar Quy
Quy - comment - 19 Sep 2018

RTC


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

avatar richard67
richard67 - comment - 19 Sep 2018

so or so, this pr is correct regarding the current way how things are done. If you want things to be done differently, feel free to make an own PR but not hijack other people'S PRs for that purpose.

avatar mbabker mbabker - change - 22 Sep 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-09-22 15:12:51
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 22 Sep 2018
avatar mbabker mbabker - merge - 22 Sep 2018

Add a Comment

Login with GitHub to post a comment