Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
base system
Priority:
Normal
Category:
Feature request
Reporter:
Anonymous (not verified)
Created:
6 Nov 2007 at 20:59 UTC
Updated:
21 Aug 2018 at 03:30 UTC
I am contemplating a patch that would allow db_prefix to specify a default table prefix for multiple databases as specified in db_url. If I have
$db_url['default'] = 'mysql://dbuser1:dbpass1@localhost/db1'
$db_url['db2'] = 'mysql://dbuser2:dbpass2@localhost/db2'
I want to be able to do something like
$db_prefix['default']['default'] = 'myprefix_';
$db_prefix['default']['db2'] = '';
This would prevent me from having to do
$db_prefix = array(
'default' => 'myprefix_',
'mydb2table1' => '',
'mydb2table2' => '',
'mydb2tableN' => '',
);
Comments
Comment #1
ttkaminski commentedI was hoping that drupal supported a prefix on a per db_url basis, but it isn't supported in drupal <= 6.x. Has this been implemented for 7.x yet?? I would rather have the url and prefix specified as follows:
I am very surprised that this hasn't already been implemented since the current implementation in 6.x assumes that the prefix is applied to all db_url connections which is simply wrong.
Comment #2
berdirThere is an issue for this at #195416: Table prefixes should be per database connection which unfortunately has been postponed to D8.
(Sorry for pinging the participants, I'm trying to clean up a few old
issues)