level12 / keg-app-cookiecutter

0 stars 0 forks source link

Consider enabling compare_type by default for alembic #120

Closed bchopson closed 3 years ago

bchopson commented 3 years ago

See https://alembic.sqlalchemy.org/en/latest/autogenerate.html#compare-types

The default alembic env setup does not include this parameter, which means some data type changes aren't detected. I think it's a sane default.

Note that compare_type=True will cause alembic autogeneration to fail for Keg-Auth's password type. Either the password type should have compare_against_backend defined, or we will need a custom compare_type function in the cookiecutter:

def compare_type(context, inspected_column, metadata_column, inspected_type, metadata_type):
    if metadata_type == KAPasswordType or type(metadata_type) == KAPasswordType:
        return False
    return None