Allow running of sql against the live DB.

Reordered the tables in the domain downgrade script to avoid breaking the integrity constraints

To run the test:
./run_tests.sh -N  test_sql_upgrade

This version removed all of the code specific to running against a live DB and merged it into the
standard tests.

Fixed a couple downgrade functions that were failing.  They had not
been tested

Change-Id: Ie1214e5543bd08fde95652af2464cc9c80db449d
Merge "Allow running of sql against the live DB."