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

Add Mysql 8 workaround #900

Merged
merged 1 commit into from Sep 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -75,9 +75,38 @@ on upgrade until Shopware 5.6, but they won't be kept in sync anymore.

For a complete overview check the **Removals** part of the <a href="https://github.com/shopware/shopware/blob/5.5/UPGRADE-5.5.md#removals">Upgrade.md</a>.

### MySQL 8 workaround

Due to a mixture of MySQL 8 and Doctrine constraints, the column `s_core_documents.ID` will be renamed to
`s_core_documents.id` on the fly if MySQL 8 is being used. To be able to do that, the service `\Shopware\Components\Compatibility\LegacyDocumentIdConverter`
was introduced, which is checked in the file `engine/Shopware/Models/Order/Document/Document.php` to determine if
a Doctrine model with uppercase or lowercase `id` needs to be used.

If you need to reference this column in your own model, we recommend to use the same workaround there. You can use the
same service (see above) with id `legacy_documentid_converter` for that.

The reason for this workaround is that MySQL 8 forces ids in foreign key constraints to be lower case.

This is a problem in current systems since we have an uppercase `ID` in table `s_order_documents`.
MySQL doesn't care if we use `ID` in the table and `id` in the constraint, but Doctrine needs both to be written
in the same way. On new installations of Shopware 5.5 this is already the case, both are lowercase there.

So in order to support MySQL 8 on updates from older Shopware versions we need to change the case of the `id` column
in `s_order_documents`, which breaks support of blue/green deployments as older versions of Shopware (< 5.5) need
that column to be uppercase.

Since this change is only really necessary if you are using MySQL 8, it is only enforced when a MySQL 8 server is
detected. A downgrade to an older Shopware installation wouldn't be possible anyway in that case, as Shopware 5.4
does not support MySQL 8 yet.

If you want to make this migration offline, there is the command `sw:migrate:mysql8` to check if the migration was
executed and do so if you want.

The column `s_core_documents.id` will be lowercase from Shopware 5.6 forward.

### Library updates

- Updated `Symfony` to version 3.4.14 LTS. Some nice, new features are <a href="https://symfony.com/blog/new-in-symfony-3-4-simpler-injection-of-tagged-services" target="_blank">Simpler injection of tagged services</a> or <a href="https://symfony.com/blog/new-in-symfony-3-4-lazy-commands" target="_blank">Command Lazyloading</a>.
- Updated `Symfony` to version 3.4.15 LTS. Some nice, new features are <a href="https://symfony.com/blog/new-in-symfony-3-4-simpler-injection-of-tagged-services" target="_blank">Simpler injection of tagged services</a> or <a href="https://symfony.com/blog/new-in-symfony-3-4-lazy-commands" target="_blank">Command Lazyloading</a>.
- Updated `jQuery` to 3.3.1. You can see the <a href="https://jquery.com/upgrade-guide/3.0/" target="_blank">jQuery update guide</a>
for a list of important and breaking changes and links to the migration plugin.
In Shopware, the relevant changes were:
Expand Down