stream
stream copied to clipboard
Create the database tables if they do not exist when resetting the DB
Create the database tables if they do not exist when resetting the database
Fixes #1284
If the plugin is loaded without activation, tables are never created and resetting the database does not create tables. This PR changes that so that if tables are missing, a reset creates them.
Checklist
- [ ] Project documentation has been updated to reflect the changes in this pull request, if applicable.
- [ ] I have tested the changes in the local development environment (see
contributing.md). - [ ] I have added phpunit tests.
Release Changelog
- Fix: Describe a bug fix included in this release.
- New: Describe a new feature in this release.
Release Checklist
- [ ] This pull request is to the
masterbranch. - [ ] Release version follows semantic versioning. Does it include breaking changes?
- [ ] Update changelog in
readme.txt. - [ ] Bump version in
stream.php. - [ ] Bump
Stable taginreadme.txt. - [ ] Bump version in
classes/class-plugin.php. - [ ] Draft a release on GitHub.
@kasparsd I don't believe it's strictly necessary, but it is nice and makes sense that a DB reset would make sure the tables are present and up to date. This is explicit where the other PR is implicit.
I don't believe it's strictly necessary, but it is nice and makes sense that a DB reset would make sure the tables are present and up to date. This is explicit where the other PR is implicit.
I've been wondering if x+1 plugins with custom tables all do their "TABLE EXISTS" checks, does it have any real performance impact or not.
In the big picture, it does seem kind of redundant to guard against a real far-edge case millions of times / year * # of plugins.
@lkraav for this PR it'll happen when a user clicks a button, as for WP Admin or CLI it's pretty safe. On the frontend it can add up quickly on a busy site