move check after engine creation

This commit is contained in:
Chico Venancio
2018-05-06 04:39:26 +00:00
parent 1549af6f56
commit f215adcfa2

View File

@@ -651,8 +651,6 @@ def new_session_factory(url="sqlite:///:memory:",
elif url.startswith('mysql'):
kwargs.setdefault('pool_recycle', 60)
if mysql_large_prefix_check(engine): # if mysql is allows large indexes
add_row_format(Base) # set format on the tables
if url.endswith(':memory:'):
# If we're using an in-memory database, ensure that only one connection
@@ -663,6 +661,8 @@ def new_session_factory(url="sqlite:///:memory:",
if reset:
Base.metadata.drop_all(engine)
if mysql_large_prefix_check(engine): # if mysql is allows large indexes
add_row_format(Base) # set format on the tables
# check the db revision (will raise, pointing to `upgrade-db` if version doesn't match)
check_db_revision(engine)