CRM: 3404 - address syntax differences between SQLite and MySQL #34869
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves Automattic/zero-bs-crm#3404 - address syntax differences between SQLite and MySQL
Proposed changes:
Transaction queries were outright failing when using SQLite. The underlying causes:
transaction
as a table alias in some of our queries. This is a reserved keyword in both MySQL and SQLite, but apparently SQLite is more strict. This PR changes the table alias totransactions
.GROUP_CONCAT()
. I logged the issue here, and in the meantime createdbuild_group_concat()
to build the proper string depending on the database engine.Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
The most painless way to do this is to set up SQLite via the SQLite Database Integration plugin. Install that on a WordPress site, initialise the site, and then you should be good to go.
In
trunk
, the dashboard shows anull
count, the transaction list shows no transactions even if you create one, and creating/viewing a transaction shows an error (see issue for screenshots).In the
fix/crm/3404-sqlite_transactions
branch, the dashboard shows the correct count, the transaction list shows transactions, and one can create/view transactions.