Fix check_003 method.

This commit fixes the check on migration 003 in test_migrations.
Previously, when this method was added it didn't check that the
data in the type column previously in the images table was moved
correctly into the image_properties table. This commit adds these
data checks.

Change-Id: Ia3906c8497218c8a3d2a13b0c99a6aa566977ed4
Fix circular import in glance/db/sqlalchemy

Fix running test_migration solely.

api.py depends on models.py that depends on api.py.
Import statements in these files are such that api.py
must be imported before models.py. That's why usually
test_migrations doesn't fail when all tests are launched.
However, thus test_migration depends on test running order
making testing procedure unreliable, including parallel testing.

Move glance.db.sqlalchemy.api import to the only place
where it's required in models.py

Change-Id: Ib20dde8edd3473595aac1ca8bbaa5a0d3116a697
Fixes: bug #1154058
Declare index on ImageMember model

This index was added in migration 008. However, it was not on the model,
which meant any autocreated db would not have it.

Fixes bug 1154777

Change-Id: I34590ffebaf547be9a12e5a85216cda145d9e8db
Merge "Fix circular import in glance/db/sqlalchemy"
Merge "Fix check_003 method."
Merge "Declare index on ImageMember model"