magento / magento/community-features
table_prefix is used globally for all db connections
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 46
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
When using an additional custom database connection you get in trouble when one of your databases uses table prefixes and the other does not.
env.php:
```
'db' => [
'table_prefix' => 'abc_',
'connection' => [
'default' => [
'host' => 'localhost',
'dbname' => 'db1',
'username' => 'db1',
'password' => 'pw1',
'active' => '1'
],
'custom' => [
'host' => 'localhost',
'dbname' => 'db2',
'username' => 'db2',
'password' => 'pw2',
'active' => '1'
]
]
],
```
I have a case where the magento DB uses prefixes and the custom database does not. With this setup the table_prefix is applied to all connections.
It would make so much more sense if table_prefix could be applied for each connection separately:
```
'db' => [
'connection' => [
'default' => [
'host' => 'localhost',
'dbname' => 'db1',
'username' => 'db1',
'password' => 'pw1',
'active' => '1',
'table_prefix' => 'abc_',
],
'custom' => [
'host' => 'localhost',
'dbname' => 'db2',
'username' => 'db2',
'password' => 'pw2',
'active' => '1',
'table_prefix' => '',
]
]
],
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the env.php configuration shown in the issue and trace how table_prefix is read for each database connection. Done means the default connection can use abc_ while the custom connection can use an empty prefix, without applying one connection's prefix globally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100