sqlalchemy - Alembic Django Flask migrate database -
i have database shared between django , flask.
in flask app, use sqlalchemy , use alembic migrate database. when migrate database , use command:
$ alembic revision --autogenerate -m "some message"
it automatically remove tables django had created:
info [alembic.migration] context impl mysqlimpl. info [alembic.migration] assume non-transactional ddl. info [alembic.autogenerate] detected removed table u'django_content_type' info [alembic.autogenerate] detected removed table u'auth_group' info [alembic.autogenerate] detected removed table u'auth_user' info [alembic.autogenerate] detected removed table u'auth_user_groups' info [alembic.autogenerate] detected removed table u'django_session' info [alembic.autogenerate] detected removed table u'auth_permission' info [alembic.autogenerate] detected removed table u'auth_user_user_permissions' info [alembic.autogenerate] detected removed table u'account_userprofile' info [alembic.autogenerate] detected removed table u'south_migrationhistory' info [alembic.autogenerate] detected removed table u'django_site'
how configure alembic database migration not remove tables of django?
i resolved problem self:
in env file, function:
def run_migrations_online(): target_metadata.reflect(engine, only=[ "django_content_type", "auth_group", ...])
put tables here. define engine tables existed , not drop them.
Comments
Post a Comment