sqlalchemy: migration error when running db-sync

migration incorrectly sorted order of tables for Events causing Event
and Trait tables to be generated before unique_name table which both tables
require

Change-Id: I6fe7ceb0905ace3993116c6a274b6c39e11554bf
Fixes:Bug #1186283
Merge "sqlalchemy: migration error when running db-sync"