-
Notifications
You must be signed in to change notification settings - Fork 3
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 searchindex helper and console command #82
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad you thought about PostgreSQL!
I'm not 💯 certain the pg test will pass. But... our whole test suite is broken... so I wouldn't consider that a blocker.
docker-compose.yml
Outdated
@@ -28,7 +28,7 @@ services: | |||
- XDEBUG_MODE | |||
|
|||
mysql: | |||
image: mysql:5.7.29 | |||
image: mysql:8.0.37 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much thanks.
tests/unit/SearchIndexHelperTest.php
Outdated
Craft::$app->getDb()->driverName = 'pgsql'; | ||
$result = SearchIndex::optimize(); | ||
|
||
// Assert: Verify that the result is an integer (number of rows affected) | ||
$this->assertIsInt($result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this might throw an SQL error unless our test environment is using PostgreSQL.
I'm planning to switch our CI tests to use GitHub actions. So I might be able to make a matrix of tests (one for MySQL one for PostgreSQL).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just merged an updated GitHub actions based test runner.
It uses a matrix to run tests with MySQL and Postgres.
It also switches the local dev environment to DDEV.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rebased this work and added test skipping based on db driver so the unit test works with the new matrix strategy.
c81f3db
to
94e91f1
Compare
I noticed that we seem to have a lot of issues with the searchindex table causing performance issues on larger sites, or sites with data import features. This update should add a handy helper method that can be called from jobs, as well as the cli to optimize that problematic table.