I am working on a PHP application that intends to ease company workflow and project management, let's say something like Basecamp and GoPlan.
I am not sure on what the best approach is, database-wise. Should I use a single database and add client-specific columns to each of the tables, or should I create a database for each new client? An important factor is automation: I want it to be dead simple to create a new client (and perhaps opening the possibility to signing up for yourself).
Possible cons I can think of using one database:
What are your thoughts on this? Do you have any ideas what solution the above companies are most likely to have chosen?
Try to keep logically related information together and unrelated information separate. Try to avoid multiple databases or tables with the same design or purpose. Multiple database apps are usually apps which have their own data requirements but also have to integrate with another existing app or service's database.
We also use Lucene (which is arguably a database), with some custom sharding code on top. Technology, yes. The same database program, not unless it's been developed to open more than one database at a time. But if you use MariaDB, you can use it on the same site to use dozens of databases, one for each access.
It's really a good question,, As I know that you are right, one can use multiple database system for a single web application.
Yes. Give it a go. "Is it possible to connect multiple database with one application." Yes. Very straightforward - two connection strings, two different connections.
I usually add ClientID to all tables and go with one database. But since the database is usually hard to scale I will also make it possible to run on different database instances for some or all clients.
That way you can have a bunch of small clients in one database and the big ones on separate servers.
A key factor for maintainability though, is that you keep the schema identical in all databases. There will be headache enough to manage the versioning without introducing client specific schemas.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With