def METHOD_NAME() -> None:
    """Downgrade."""
    schema = config["schema"]
    op.drop_constraint("layergroup_treeitem_treeitem_id_fkey", "layergroup_treeitem", schema=schema)
    op.create_foreign_key(
        "layergroup_treeitem_treeitem_id_fkey",
        "layergroup_treeitem",
        source_schema=schema,
        local_cols=["treeitem_id"],
        referent_table="treeitem",
        referent_schema=schema,
        remote_cols=["id"],
    )
    op.drop_constraint("treegroup_id_fkey", "treegroup", schema=schema)
    op.create_foreign_key(
        "treegroup_id_fkey",
        "treegroup",
        source_schema=schema,
        local_cols=["id"],
        referent_table="treeitem",
        referent_schema=schema,
        remote_cols=["id"],
    )
    op.drop_constraint("ui_metadata_item_id_fkey", "ui_metadata", schema=schema)
    op.create_foreign_key(
        "ui_metadata_item_id_fkey",
        "ui_metadata",
        source_schema=schema,
        local_cols=["item_id"],
        referent_table="treeitem",
        referent_schema=schema,
        remote_cols=["id"],
    )
    op.drop_constraint("layer_id_fkey", "layer", schema=schema)
    op.create_foreign_key(
        "layer_id_fkey",
        "layer",
        source_schema=schema,
        local_cols=["id"],
        referent_table="treeitem",
        referent_schema=schema,
        remote_cols=["id"],
    )
    op.drop_constraint("layergroup_id_fkey", "layergroup", schema=schema)
    op.create_foreign_key(
        "layergroup_id_fkey",
        "layergroup",
        source_schema=schema,
        local_cols=["id"],
        referent_table="treegroup",
        referent_schema=schema,
        remote_cols=["id"],
    )
    op.drop_constraint("interface_layer_layer_id_fkey", "interface_layer", schema=schema)
    op.create_foreign_key(
        "interface_layer_layer_id_fkey",
        "interface_layer",
        source_schema=schema,
        local_cols=["layer_id"],
        referent_table="layer",
        referent_schema=schema,
        remote_cols=["id"],
    )
    op.drop_constraint("layer_wms_id_fkey", "layer_wms", schema=schema)
    op.create_foreign_key(
        "layer_wms_id_fkey",
        "layer_wms",
        source_schema=schema,
        local_cols=["id"],
        referent_table="layer",
        referent_schema=schema,
        remote_cols=["id"],
    )