+def check_db_up_to_date():
+ """Check if the database is up to date and quit if not"""
+ dbdatas = gather_database_data(mgg.global_config.get('plugins', {}).keys())
+
+ for dbdata in dbdatas:
+ migration_manager = dbdata.make_migration_manager(Session())
+ if migration_manager.database_current_migration is None or \
+ migration_manager.migrations_to_run():
+ sys.exit("Your database is not up to date. Please run "
+ "'gmg dbupdate' before starting MediaGoblin.")
+
+