• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keeping continuity between multiple databases

#1
[eluser]jleequeen[/eluser]
I brought up this question in a reply to another post, but thought it warranted one of it's own.

In a situation where you have multiple CI applications each running there own databases but those applications need to start talking to the other databases, what do you do? What is the best way to approach this?

Is it ok to alter the database of another app through the model from a separate application?

#2
[eluser]Mirage[/eluser]
1. You do this by defining multiple database groups in the db config or by using specific DSNs when connecting to a DB in a class or function.

2. Whether it's ok for one app to alter the db of another app, depends entirely on your problem, goals and application design. In general there's nothing wrong with it. There are probably more than a few CI driven sites out there that interact directly with the db of e-commerce solutions, etc.

A better approach in some circumstances would probably be for the app that primarily controls the database to offer an API to other apps by which they can modify the database. But it's definitely more coding work and might be overkill depending on the needs.

HTH
-m

#3
[eluser]jleequeen[/eluser]
Yeah, that helped. Thanks Mirage. I'm going to look into multiple database groups in the db config. I think it would be too much to build an API and overkill as you said. The separate application is more like a sub app in a sense, but it is more different than not. I thought about trying to extend upon the main app and make it a larger application, but I don't think it's worth the effort to try and fit things together that don't neccessarily need to be. I just need to make sure there is some consistency between the databases in the sense that if a user gets deleted in one, it gets done in the other database and that kind of thing. I've never really dealt with cross database issues up until now. It's so much nicer when things fit in and stay in there own box, lol.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.