0

In implementing upgrades to an existing Python application, on a development server, one MySQL table has gained an additional column but another has gained 23. What is the best way to add these to to the production servers. There are two servers within the company but a few dozen outside who want the update.

Many thanks...

2 Answers 2

1

Answering for main question -

  1. The Best way, use any kinds of database modelling software. Including MySQL Workbench. Where all changes first do on schema diagram, than sync with any number of database. Many of them prepare for You clear SQL scrip which You can run independently. Very good tools - DBSchema.
  2. Other possible way - use any kind of database synchronisation
    software, such as:

Next programs (not only) has functional for sync structure of databases

  • SQLyog and
  • MySQL Workbench
  • Navicat
0

The syntax will be:

ALTER TABLE <TAB_NAME> ADD <COLUMN_NAME> <TYPE>;

Repeat for each column. If your new columns have NOT NULL constraints to them, you would need to create them with NULL allowed, update the rows then change the constraint to not null.

For deployment of the changes to all the servers. It really depends on your infrastructure and your security policies.

If you have ssh to all 12 sites, you could have your deployment script on one of the servers and run it on every other ones from there.

If not, good old elbow grease would do it. 12 isn't a big number.

Don't forget to backup your database before applying the change. I would actually include the backup in my deployment script and have a rollback.sql script to restore the backup just in case.

1
  • 1
    Faster: Have a single ALTER with all the new columns for one table.
    – Rick James
    Dec 12, 2015 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.