bhavaniravi commented on issue #18323:
URL: https://github.com/apache/airflow/issues/18323#issuecomment-921686654


   Yes, it's possible in the alembic. [Check this SO 
answer](https://stackoverflow.com/a/56085521/6340775)
   
   A similar airflow snippet would look like, used `check_migrations` as a 
template
   
   ```
   def compare_migrations():
       from alembic.runtime.migration import MigrationContext
       from alembic.script import ScriptDirectory
   
       config = _get_alembic_config()
       script_ = ScriptDirectory.from_config(config)
       with settings.engine.connect() as connection:
           context = MigrationContext.configure(connection)
           if context.get_current_revision() != script_.get_current_head():
               raise exceptions.DatabaseIsNotUpToDate('Upgrade the database.')
   ```
   
   Do we do this check every time we start the webserver or scheduler?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to