Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No easy way to switch between database connections #1634

Closed
codemedic opened this issue Jan 12, 2015 · 20 comments
Closed

No easy way to switch between database connections #1634

codemedic opened this issue Jan 12, 2015 · 20 comments

Comments

@codemedic
Copy link
Contributor

When working with multiple databases, it seems not possible to switch between database connections (DSNs).

A typical use case would be in situations where you have two databases which are differently tuned; for the kind of data they deal with. One for configuration lookup, i.e high performance, almost all coming from memory, and the other database server for huge tables, say for example logs or financial transaction history.

If one needs to write a test that would talk to multiple databases, it would be handy to be able to switch between DSNs at will during the test.

@codemedic
Copy link
Contributor Author

Example test script would look like ...

$I->amConnectedToDb('Database1');
$I->haveInDatabase(...);

$I->amConnectedToDb('Database2');
$I->haveInDatabase(...);
...

codemedic added a commit to redmatter/Codeception that referenced this issue Jan 12, 2015
codemedic added a commit to redmatter/Codeception that referenced this issue Jan 12, 2015
codemedic added a commit to redmatter/Codeception that referenced this issue Jan 12, 2015
Stringises a cleanup action so that it appears better on console.
Also fixes a typo namespace error.
@codemedic
Copy link
Contributor Author

Please can one of you experienced souls review this issue/feature request and the PR

@pribbernow-marc
Copy link

Would be very helpful. Thanks for report @codemedic!

@sangar82
Copy link

+1! I need this feature!

I work in a big project with a one database for each client. I need to change the connection to connect this DB's.

@sanderbrauwers
Copy link

+1

@codemedic
Copy link
Contributor Author

I have kicked off an extension https://github.com/natterbox/Codeception-MultiDb
Comments and bug reports most welcome.

@gilbitron
Copy link

+1

1 similar comment
@kappakp88
Copy link

+1

@codemedic
Copy link
Contributor Author

@gilbitron and @kpascal
Guys, please can you have a look at the package natterbox/codeception-multidb on packagist.
More details at https://github.com/natterbox/Codeception-MultiDb

@olleharstedt
Copy link

👍

1 similar comment
@rogoit
Copy link

rogoit commented Apr 8, 2016

+1

@tomotomo
Copy link

Nice Idea

@raistlin
Copy link
Member

raistlin commented May 23, 2016

I haven't done a deep review on @codemedic code, but seems ok.
Could you create a PR on codeception's website repository to add a brief info of your extension, a simple text line on the readme or other more appropriate file is more than enough.

@rogoit
Copy link

rogoit commented May 25, 2016

I use sqlite connection and switch with _reconfigure on a helper...so i can also read db settings from .env file

@kappakp88
Copy link

its great that we all use this and this but how about a working copy example so others can be successful with "this and this" configurations

@rogoit
Copy link

rogoit commented May 25, 2016

We do not have all the same settings because everybody has a special usecase

@codemedic
Copy link
Contributor Author

@raistlin Please can you point me in the right direction.
Where do I add that? Please can you let me know the location within the repo.

Ta

@goffyara
Copy link

@raistlin
Copy link
Member

You should create a PR against Codeception web https://github.com/Codeception/codeception.github.com
I think the best place to add the information is on the "Extensions" section.

codemedic added a commit to codemedic/codeception.github.com that referenced this issue May 28, 2016
As discussed on Codeception/Codeception#1634.
Adding brief description of Red Matter's MultiDb module which is available on packagist.org as `redmatter/codeception-multidb`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests