Problem/Motivation
In #3106531: Notify in Status Report that per-table database prefixes are no longer supported, and will throw errors in Drupal 10.0 we deprecated per-table prefixing and the 'prefix' connection array key in array form.
The per-table prefixing needs to be removed in D10.
Proposed resolution
-
Deprecated for removal in D11 the class variables (all protected):
Drupal\Core\Database\Connection::$prefixes,Drupal\Core\Database\Connection::$prefixSearch,Drupal\Core\Database\Connection::$prefixReplaceandDrupal\Core\Database\Connection::$unprefixedTablesMap. - Deprecated for removal in D11 the method
Drupal\Core\Database\Connection::getUnprefixedTablesMap() -
Added the class variables (private):
Drupal\Core\Database\Connection::$prefixandDrupal\Core\Database\Connection::$tablePlaceholderReplacements. ::setPrefix()now accepts only strings.
Remaining tasks
User interface changes
API changes
See proposed solution.
Data model changes
Release notes snippet
Drupal previously supported per-table prefixing for complex multisite setups. This functionality has been deprecated since Drupal 8.2, and warnings are displayed on the status reports of sites stil using this functionality since Drupal 9.3.0. The functionality has been removed from Drupal 10. See the change record for alternatives to per-table prefixing.
| Comment | File | Size | Author |
|---|
Issue fork drupal-3124382
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3124382-pp-1-remove-per-table
changes, plain diff MR !1607
Comments
Comment #2
daffie commentedComment #3
mondrakeJust a curiosity to see what breaks.
Comment #4
mondrakeComment #5
mondrakeComment #6
mondrakeComment #7
mondrakeNeed to do #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10 first.
Comment #8
mondrakeComment #10
mondrakeComment #11
mondrakeComment #12
daffie commentedIn the method Drupal\pgsql\Driver\Database\pgsql\Schema::findTables() is the deprecated method
getUnprefixedTablesMap()called.Patch looks good.
Comment #13
mondrakeThanks @daffie
Comment #14
daffie commentedThe MR is for me RTBC.
I will work on the CR tomorrow.
Comment #15
daffie commentedAll code changes look good to me.
The IS and the CR are in order.
For me it is RTBC.
Comment #16
mondrakewe need to update the MR with the actual number of the CR
Comment #17
mondrakeComment #18
daffie commentedOeps!
It is fixed.
Back to RTBC.
Comment #19
alexpottI think the change as it current is results in an change in the output of function unexpectedly.
Comment #20
mondrakeThat code comes straight from D8 https://git.drupalcode.org/project/drupal/-/blob/8.9.x/core/lib/Drupal/C...
Doing some archeocodololgy, AFAICS the idea was to convert the 'prefix' element (that was an array there) to a list of tables that had a different prefix than the default --
$table_nameas a variable name is not a very happy one, it's the key of the 'prefix' array.In other words, a 'prefix' array like
would result in
::getUnprefixedTablesMap()returningSince we no longer have per-table prefixes as a result of this patch,
::getUnprefixedTablesMap()would return an empty array which is correct IMHO.Comment #21
catchCouple of questions on the MR.
Comment #22
mondrakeThanks @catch, addressed your points.
Comment #23
daffie commentedBoth points of @catch have been addressed.
The "extra_prefix" stuff from the SQLite database driver makes it for me that we can only do this in D10 and remove it in D11. Just a lot cleaner and it is not in the way.
Comment #25
catchCommitted e1c6ba3 and pushed to 10.0.x. Thanks!
Comment #26
mondrakePublished CR
Comment #28
xjmI went ahead and attached the original CR to this issue (from all the way back in Drupal 8.2): https://www.drupal.org/node/2768219
I'm confused though. The IS says:
But then it goes onto say a bunch of stuff is deprecated for removal in D11, and the patch is adding deprecations for D11 removal as well, not removing any existing deprecations.
I would've expected this issue to wait for 10.1.x. Do we need to mention it in the release notes? Or does the followup to actually remove the feature get mentioned in the 11.0.0 release notes?
Comment #29
daffie commented@xjm: The per-table prefixing is removed in D10. A number of class variables and method are deprecated in D10.0 and will be removed in D11.0.
Comment #30
xjmOK, let's put this in the release notes then since this would blow your site up if you missed it. Thanks!
Comment #31
xjmAdding a release note.
Comment #32
xjm