Problem/Motivation
Proposed resolution
Remaining tasks
User interface changes
API changes
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | interdiff.txt | 655 bytes | dawehner |
| #26 | 2338747-26.patch | 44.97 KB | dawehner |
| #24 | interdiff.txt | 491 bytes | dawehner |
| #24 | 2338747-24.patch | 44.97 KB | dawehner |
| #22 | 2338747-22.patch | 45.45 KB | dawehner |
Comments
Comment #1
dawehner.
Comment #3
Crell commentedI don't know what the point is without an issue summary.
This feels very weird. I don't have a more specific word for it off hand. :-) Rather, this operation should be encapsulated into ensureTableIsReady() or something, which will create it if it doesn't exist, truncate it if it does, etc.
There's a very specific exception thrown for missing table. Just catch that, then you don't need the re-throw.
Comment #4
dawehnerWell, I just applied a technique used in the MenuTreeStorage.
Well, the great advantage of this technique is that you don't require runtime overhead and you don't have to care about.
A great.
Comment #5
chx commentedRerolled. Review is not addressed but this has a higher chance of passing as it now passes the actual query objects to safeDatabaseExecute and doesn't want to execute the result either.
Comment #7
dawehnerThis could be it.
Comment #9
chx commented#2371709: [PP-x] Move the on-demand-table creation into the database API
Comment #10
mgiffordComment #11
dawehnerThere we go, a new patch, especially based upon the comment https://www.drupal.org/node/2371709#comment-10376429
Comment #14
dawehnerMh, too bad.
Comment #15
dawehnerMost of the advantages of this patch is already solved by #2605684: Routing silently fails in kernel tests
Comment #16
dawehnerNew version of it.
Comment #18
dawehnerNew version, this time it should also apply.
Comment #20
dawehnerThere we go.
Comment #21
Crell commentedThe method name here is seriously weird. "safe" execute is right up there with "safe mode" or "mysql_no_really_for_reals_escape_string" as a name that is a code smell as it lacks context. :-)
As noted in an earlier comment, the model here is weird. This is off the critical path, so ensureTable() would typically add one very simple query to a rare operation that is already several hundred queries; ie, it wouldn't be noticeable.
If we want to stick to the catch-exception approach, then we need a better name here that is more self-descriptive. I am also tempted to say that the table definition should be passed in as well, as we were discussing in the DB issue, but in context that may not be necessary as a one-off.
There's no value to this being static, so don't make it static.
Comment #22
dawehnerYeah I guess we could get rid of the method, it is not really helpful, especially because its just used by one method basically.
Comment #24
dawehnerJust a merge conflict.
Comment #25
Crell commentedShould this catch be more specific than a Pokemon exception? Just database exceptions, for instance?
(The same applies elsewhere in the patch.)
Since schemaDefinition() is no longer static, we can't call it this way. It should error. Just $this->schemaDefinition().
Other than those fairly small nits, this looks good.
Comment #26
dawehnerThank you for the quick review crell!
Well, this is the approach we went with on all the lazy table issues.
Sure, let's go with it.
Comment #27
Crell commentedOK, split the difference. Thanks, dawehner!
Comment #28
tstoecklerYou wish... :-)
Comment #29
dawehnerThank you @crell!
Comment #30
catchThere's no 'table doesn't exist exception' that can be reliably used across sqlite, mysql, postgres - we tried that in the original issue that added this pattern.
Patch looks great. Committed/pushed to 8.1.x, thanks!
Comment #32
klausiThis change broke Rules tests in interesting ways and we need to have Drupal version switches now in some tests, because our tests run on both branches.
A change notice would have been nice when we make test breaking changes like this.
Comment #33
dawehner@klausi
See #2672670: Add BC layer in installSchema to support url_alias for the new KernelTestBase