Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

SQL fixes for PR #6 #10

Merged
merged 32 commits into from Sep 24, 2022

Conversation

richard67
Copy link
Contributor

@richard67 richard67 commented Aug 13, 2022

Pull Request for PR #6 .

Summary of Changes

This Pull Request (PR) fixes errors in the installation and update SQL scripts and one error in the tours model and adapts the update SQL scripts to the enhancements made with PR joomla/joomla-cms#37156 for the 4.2 version for more fault tolerant update SQL scripts.

The changes have been made with several commits in a comprehensive way so you can understand why a change has been made.

Simply go to the list of commits of this PR. You can expand the descriptions with details or links to details by using the "..." right beside the title of each commit.

By clicking on the title (or better right click and chose open in a new tab) you can then see the changes made with this commit.

Testing Instructions

Check that a new installation and after that login to backend work without SQL errors on all kinds or supported databases (MySQL or MariaDB and PostgreSQL).

Check that updating any 3.10 or 4.x version to a package build with this PR and after that login to backend work without SQL errors on all kinds or supported databases (MySQL or MariaDB and PostgreSQL).

Actual result BEFORE applying this Pull Request

New installations and updates fail for sure with PostgreSQL.

Hard-coded user IDs used for created by and modified by users for the new data on new installations and updates.

On PostgreSQL you get an SQL error due to hardcoded MySQL names quotes being used in an SQL query in the guided tours model.

MySQL data types were used in SQL scripts for PostgreSQL.

Wrong data types (strings instead of numbers or datetimes/timestamps) used for values in insert statements.

....

Expected result AFTER applying this Pull Request

No such errors anymore.

Documentation Changes Required

None.

khu5h1 and others added 26 commits August 11, 2022 00:00
- Fix wrong lft, rgt and level value
- Remove unused asset for plugin
- Adapt rgt value of the root item to the new asset
When inserting values into a table with specifying the values for an auto-incremented ID column, the next value of the corresponding sequence has to be set on PostgreSQL databases.
The values for the "ordering" and  "state" are missing here, which causes an SQL error when installing Joomla on a PostgreSQL database.
On updates we do not create new assets, so we use asset_id zero for the records we insert on updates, see e.g. 4.0.0-2018-05-15.sql
Explanation see description of commit joomla-projects@c1476f6 .
- Some code style fixes
- Be consistent with how you specify primary keys in MySQL
- On update, insert new extensions with one insert statement and use ordering 0
Add missing extensions record for the plugin for new installations on PostgreSQL
- The checked_out and checked_out_time columns meanwhile allow null values and so also should not have a default value.
- Use  data types consistent with other tables for these columns.
- Use correct data types in PostgreSQL.
- Remove "state" column which is not  used for MySQL either.
The soundex function has to be the last thing in this file.
- Do not use wrong values for created and modified times.
- Do not use hardcoded user ID.
- Hardcoded MySQL names quotes in this query lead to an SQL error on PostgreSQL databases
- Added other missing names quotes
Remove wrong code possibly resulting from copy and paset
@richard67 richard67 changed the title [Work in Progress] Fixes for PR #6 SQL fixes for PR #6 Aug 13, 2022
@richard67 richard67 marked this pull request as ready for review August 13, 2022 17:55
The database checker for PostgreSQL seems to have a problem when the opening bracket is in a new line. This has to be fixed elsewhere, For now adapt to this behavior.
@khu5h1 khu5h1 mentioned this pull request Sep 5, 2022
7 tasks
@khu5h1 khu5h1 merged commit 2e6c962 into joomla-projects:cleanup Sep 24, 2022
@richard67 richard67 deleted the cleanup-fix-sql-2022-08-13 branch September 24, 2022 12:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants