Fix issue with DB upgrade to assignment table

There are two changes:
- Commit changes to the grant tables after each update to ensure MySQL
  doesn't get confused when there are multiple assignments for a given
  actor/target (Postgresql doesn't have this issue)
- Close any sessions in test_sql_upgarde before we call the migrations,
  to ensure table dropping won't be blocked

Fixes bug 1284700

Change-Id: I81704b17ea9c11be926018df125fcfdb79ee6271
Merge "Fix issue with DB upgrade to assignment table"