Jump to content

local vs. live table in database


thescientist

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...