? ? Pending

User tests: Successful: Unsuccessful:

avatar richard67
richard67
1 Jun 2020

Pull Request for #29279 (comment) (partly).

Summary of Changes

This Pull Request (PR) adds a check for table rename to the database schema check and fix so that such statements in update SQL scripts will not be ignored anymore by the database check and fix.

Currently without this PR the database schema check and fix ignores the following schema change:

Testing Instructions

There are 2 tests to be done:

  1. Reproduce the issue without the patch of this PR applied.
  2. Check that the issue is fixed with the patch of this PR applied.

It needs tests with MySQL and with PostgreSQL databases.

Testers please report back which kind of database you have used for the test. If you have both, please test both.

We can better count then if we have enough tests for both kinds of databases.

Currently we have:

  • One successful test with MySQL.
  • No test yet with PostgreSQL.

Test 1: Reproduce issue

  1. On a clean current 4.0-dev or latest nightly or 4.0 Beta 1, login to backend and go to "System - Information - Database"
    Result: There are no database errors shown for the CMS.
  2. Move the mouse over the green badge of the CMS to see the details in a pop-up.
    Result:
    database-no-errors-pr-not-applied
  3. Note the numbers of checked and skipped database changes for later test "Test 2".
  4. Using a tool like e.g. phpMyAdmin or phpPgAdmin (depending on your database type), revert the renaming of the table in the statement mentioned in the Summary of Changes above:
  • MySQL:
RENAME TABLE `#__history` TO `#__ucm_history`;
  • PostgreSQL:
ALTER TABLE "#__history" RENAME TO "#__ucm_history";

(replace #__ by your database prefix).

  1. Go again to "System - Information - Database", or of you still are on that page, close all alerts and refresh the page:
    Result: There are database errors shown, but not about a missing table, only about wrong columns.
    database-errors-pr-not-applied-table-renamed-back-to-old
  2. Close all alerts.
  3. Select the check bow for the row with the CMS and use the "Update Structure" button (formerly known as "Fix").
    Result: Same as before in step 5, the errors can't be fixed.

Test 2: Test the fix

You have to start again with a clean installation, i.e. not use the one from the test before.

  1. Apply the patch of this PR on a clean current 4.0-dev or latest nightly or 4.0 Beta 1 installation.
  2. Login to backend and go to "System - Information - Database"
    Result: There are no database errors shown for the CMS.
  3. Move the mouse over the green badge of the CMS to see the details in a pop-up.
    Result:
    database-no-errors-pr-applied
  4. Compare the numbers of checked and skipped database changes with those noted in step 3 of the previous test "Test 1".
    Result: One more change is checked and one less is skipped.
  5. Using a tool like e.g. phpMyAdmin or phpPgAdmin (depending on your database type), revert the renaming of the table in the statement mentioned in the Summary of Changes above:
  • MySQL:
RENAME TABLE `#__history` TO `#__ucm_history`;
  • PostgreSQL:
ALTER TABLE "#__history" RENAME TO "#__ucm_history";

(replace #__ by your database prefix).

  1. Go again to "System - Information - Database", or of you still are on that page, close all alerts and refresh the page:
    Result: There are database errors shown about a missing table and about wrong columns.
    database-errors-pr-applied-table-renamed-back-to-old
  2. Close all alerts.
  3. Select the check bow for the row with the CMS and use the "Update Structure" button (formerly known as "Fix").
    Result: Same as steps 2 and 3, no errors, database is up to date.

Expected result

Table rename statements in update SQL scripts are handled by the database schema check and fix.

Actual result

Table rename statements in update SQL scripts are ignored by the database schema check and fix.

Documentation Changes Required

None, since the way how the database check and fix works is not documented anywhere except in the heads of a few people.

Additional information

Same as the existing checks for renaming columns, the check for renaming tables added by this PR does not check for the old name, i.e. if the table or column has a name different to both the old and the new name, the check doesn't work. To fix this is out of the cope of this PR.

avatar richard67 richard67 - open - 1 Jun 2020
avatar richard67 richard67 - change - 1 Jun 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Jun 2020
Category Administration Language & Strings Libraries
avatar richard67 richard67 - change - 1 Jun 2020
The description was changed
avatar richard67 richard67 - edited - 1 Jun 2020
avatar richard67 richard67 - change - 1 Jun 2020
The description was changed
avatar richard67 richard67 - edited - 1 Jun 2020
avatar richard67 richard67 - change - 1 Jun 2020
The description was changed
avatar richard67 richard67 - edited - 1 Jun 2020
avatar richard67 richard67 - change - 1 Jun 2020
The description was changed
avatar richard67 richard67 - edited - 1 Jun 2020
avatar richard67 richard67 - change - 1 Jun 2020
The description was changed
avatar richard67 richard67 - edited - 1 Jun 2020
avatar richard67 richard67 - change - 1 Jun 2020
The description was changed
avatar richard67 richard67 - edited - 1 Jun 2020
avatar richard67
richard67 - comment - 1 Jun 2020

@alikon Please test with PostgreSQL if you can find some time. It doesn't need much. We don't have so many PostgreSQL testers, as you know. (begging)

avatar N6REJ N6REJ - test_item - 1 Jun 2020 - Tested successfully
avatar N6REJ
N6REJ - comment - 1 Jun 2020

I have tested this item successfully on b849e93

using mysql 5.7.26. Had a problem with my phppgmyadmin so couldn't test


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

avatar richard67 richard67 - change - 1 Jun 2020
The description was changed
avatar richard67 richard67 - edited - 1 Jun 2020
avatar alikon alikon - test_item - 2 Jun 2020 - Tested successfully
avatar alikon
alikon - comment - 2 Jun 2020

I have tested this item successfully on b849e93

mysql 8.0.20
postgresql 11.7


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

avatar alikon alikon - change - 2 Jun 2020
Status Pending Ready to Commit
avatar alikon
alikon - comment - 2 Jun 2020

RTC


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

avatar richard67 richard67 - change - 2 Jun 2020
Labels Added: ? ?
avatar HLeithner HLeithner - change - 2 Jun 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-06-02 11:23:53
Closed_By HLeithner
Labels
avatar HLeithner HLeithner - close - 2 Jun 2020
avatar HLeithner HLeithner - merge - 2 Jun 2020
avatar HLeithner
HLeithner - comment - 2 Jun 2020

Thanks

avatar richard67
richard67 - comment - 2 Jun 2020

Always a pleasure :-)

avatar richard67
richard67 - comment - 2 Jun 2020

And thanks to the testers. Really appreciated.

Add a Comment

Login with GitHub to post a comment