Jump to content

PHP Mysql database schema compare and update


Danny620

Recommended Posts

Does the script have to determine which has the most recent updates?

 

Why are you storing the same data in two different databases?

 

Are you looking to do this as efficiently as possible? Or can you just dump the entire contents of the "current" database, empty the old database, and repopulate it with the "current" one?

Link to comment
Share on other sites

I have deployed 10 blogging database platforms now when i change the devlopment one i want the 10 blogging database to mirror them changes so i would like a script that would connect to the main devlopment one then connect to an outdated one and update it to match current one.

Link to comment
Share on other sites

So you want to maintain the data on the 10 remote databases?

 

That's going to be tricky.

 

To automate it completely, you first have to grab the details of both tables, sort out the differences, then generate and execute a custom ALTER TABLE query.

 

I'd instead suggest making a script that allows you to perform a single query on all of your remote databases. You then manually create your alter queries based on the changes you've made, and input that into the script.

 

Personally, I'd have a single database. Add a new table, called blogs. That table will have a row for each of the 10 blogs you have, along with any configuration needed specific the that blog. Then, each other table gets an extra row, called blogID, or something similar. Rows in those tables can be specific to a blog by setting blogID to the blog's unique id.

You now have a single database you need to update, rather than trying to update 10 each time a change is made.

Link to comment
Share on other sites

Databases like MySQL are designed to handle millions of rows per table. It's scalable over multiple computers to handle the heaviest of loads.

 

If you get to the point where you're handling tables at those sizes, you'd probably want to hire a database specialist any ways.

 

Generally though, if what you're searching for is properly indexed and the hardware can handle it, you should be safe.

 

Regardless, it'll be WAY less of a headache than trying to manage 1000+ different databases/servers

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.