Making SQL management commands migration aware.
Merge pull request #2743 from valberg/migration_aware_sql_commands

Making SQL management commands migration aware.