Jump to content

local vs. live table in database


thescientist
 Share

Recommended Posts

I have a question about maintaining a live database and how to successfully merge local tables into the the live ones. For instance, if I've created a table locally, then tested it and exported and imported it into my live database, how do make changes to the local table and upload it to the live server without having to drop the live table first? Whenever I try and upload a table that already exists, I get an error saying it exists (naturally). So how do local and live instances of database/tables live together? If upload a new version of a webpage, the ftp client simply copies over the live version with the local one (or vice versa). How could one accomplish this sort of convenience with databases, short of re-running all the SQL commands to make the live one match the local one.Hopefully that made sense! :)

Link to comment
Share on other sites

MySQL Workbench has an option of generating an ALTER script from a certain shapshot of the schema (either wirtten in Workbench or from a reverse engineered schema from an actual connection) to the current one you've created in it. I haven't personally used it yet, so I can't tell you if it works well.A common approach after backing up the DB of course, is to create the additional columns into the existing tables, populate them with the old data, altering it along the way to fit the new form, not entering anything that is to be removed. Once all of the new form of the data is populated properly, upload the new PHP script that will handle it, and finally, remove the old form of the data.Some particular examples of this are given on Zend's devzone, and this article in particular.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...