Issues

Issue #79 wontfix

autogenerate for ondelete/onupdate

Robert Kopaczewski
created an issue

Autogenerate currently doesn't pick up changes in (or new) columns with ondelete/onupdate.

e.g. modified_at = Column(DateTime(), onupdate=datetime.now) will be translated to: sa.Column('modified_at', sa.DateTime(), nullable=True),

Same for ForeignKeys with ondelete/onupdate.

Comments (2)

  1. Mike Bayer repo owner

    Column(.., onupdate=) is a Python-side only default generation function and does not apply to database migrations.

    As for foreign keys, onupdate/ondelete have an entirely different meaning, that of the cascade behavior of the FK. Auto-detection of changes in foreign keys is not supported right now, see the last section in https://alembic.readthedocs.org/en/latest/tutorial.html#auto-generating-migrations "Autogenerate can’t currently, but will eventually detect:".

  2. Log in to comment