def METHOD_NAME():
    """Reset the alembic state carried over from 1.9.x.
    Only run this command right after upgrading from a 1.9.x version
    so the references to old alembic revisions (which were removed in
    2.0) are reset.
    """
    tables = get_all_tables(db)['public']
    if 'alembic_version' not in tables:
        print('No alembic_version table found')
        sys.exit(1)
    current_revs = [rev for rev, in db.session.execute('SELECT version_num FROM alembic_version').fetchall()]
    if current_revs != ['65c079b091bf']:
        print('Your database is not at the latest 1.9.11 revision (got [{}], expected [65c079b091bf]).'
              .format(', '.join(current_revs)))
        print('This can have multiple reasons:')
        print('1) You did not upgrade from 1.9.x, so you do not need this command')
        print('2) You have already executed the script')
        print('3) You did not fully upgrade to the latest 1.9.11 revision before upgrading to 2.x')
        print('In case of (3), you need to install v1.9.11 and then upgrade the database before updating Indico back '
              'to {}'.format(indico.__version__))
        sys.exit(1)
    plugins = sorted(x[23:] for x in tables if x.startswith('alembic_version_plugin_'))
    print('Resetting core alembic state...')
    _stamp()
    print('Plugins found: {}'.format(', '.join(plugins)))
    no_revision_plugins = {'audiovisual', 'payment_cern'}
    for plugin in no_revision_plugins:
        # All revisions were just data migrations -> get rid of them
        if plugin not in plugins:
            continue
        print(f'[{plugin}] Deleting revision table')
        db.session.execute(f'DROP TABLE alembic_version_plugin_{plugin}')
    plugin_revisions = {'chat': '3888761f35f7',
                        'livesync': 'aa0dbc6c14aa',
                        'outlook': '6093a83228a7',
                        'vc_vidyo': '6019621fea50'}
    for plugin, revision in plugin_revisions.items():
        if plugin not in plugins:
            continue
        print(f'[{plugin}] Stamping to new revision')
        _stamp(plugin, revision)
    db.session.commit()