def METHOD_NAME():
    if skip_based_on_legacy_engine_version(op, __name__):
        return
    op.rename_table('package_group', 'member')
    op.rename_table('package_group_revision', 'member_revision')
    op.alter_column(
        'member', 'package_id', new_column_name='table_id', nullable=False
    )
    op.alter_column(
        'member_revision',
        'package_id',
        new_column_name='table_id',
        nullable=False
    )
    op.drop_constraint('package_group_revision_pkey', 'member_revision')
    op.drop_constraint(
        'package_group_revision_continuity_id_fkey', 'member_revision'
    )
    op.drop_constraint(
        'package_group_revision_group_id_fkey', 'member_revision'
    )
    op.drop_constraint(
        'package_group_revision_package_id_fkey', 'member_revision'
    )
    op.drop_constraint(
        'package_group_revision_revision_id_fkey', 'member_revision'
    )
    op.drop_constraint('package_group_pkey', 'member')
    op.drop_constraint('package_group_group_id_fkey', 'member')
    op.drop_constraint('package_group_package_id_fkey', 'member')
    op.drop_constraint('package_group_revision_id_fkey', 'member')
    op.add_column(
        'member', sa.Column('table_name', sa.UnicodeText, nullable=False)
    )
    op.add_column(
        'member', sa.Column('capacity', sa.UnicodeText, nullable=False)
    )
    op.add_column(
        'member_revision',
        sa.Column('table_name', sa.UnicodeText, nullable=False)
    )
    op.add_column(
        'member_revision',
        sa.Column('capacity', sa.UnicodeText, nullable=False)
    )
    op.create_primary_key('member_pkey', 'member', ['id'])
    op.create_primary_key(
        'member_revision_pkey', 'member_revision', ['id', 'revision_id']
    )
    op.create_foreign_key(
        'member_group_id_fkey', 'member', 'group', ['group_id'], ['id']
    )
    op.create_foreign_key(
        'member_revision_id_fkey', 'member', 'revision', ['revision_id'],
        ['id']
    )
    op.create_foreign_key(
        'member_revision_continuity_id_fkey', 'member_revision', 'member',
        ['continuity_id'], ['id']
    )
    op.create_foreign_key(
        'member_revision_group_id_fkey', 'member_revision', 'group',
        ['group_id'], ['id']
    )
    op.create_foreign_key(
        'member_revision_revision_id_fkey', 'member_revision', 'revision',
        ['revision_id'], ['id']
    )
    op.add_column('group', sa.Column('type', sa.UnicodeText, nullable=False))
    op.add_column(
        'group_revision', sa.Column('type', sa.UnicodeText, nullable=False)
    )
    op.add_column('package', sa.Column('type', sa.UnicodeText))
    op.add_column('package_revision', sa.Column('type', sa.UnicodeText))