From 78f45edbb0da8ccc52ad0f1f641ecb6a7ef61ec6 Mon Sep 17 00:00:00 2001 From: Radu Carpa Date: Wed, 27 Sep 2023 10:56:32 +0200 Subject: [PATCH] Core & Internals: remove support for old distances table format The code was intended to allow both 1.29 and 1.30 servers to run in parallel on the same database. This should have no effect on everybody who correctly applied the migrations. --- lib/rucio/db/sqla/models.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/rucio/db/sqla/models.py b/lib/rucio/db/sqla/models.py index 298df358d60..28a15f8f580 100644 --- a/lib/rucio/db/sqla/models.py +++ b/lib/rucio/db/sqla/models.py @@ -1408,24 +1408,12 @@ class SourceHistory(BASE, ModelBase): ) -# Compatibility code to permit 1.30 to run with a distances table from the 1.29 database schema -# TODO: remove this code in rucio 1.31 -_distance_column_name = 'distance' -_engine = get_engine() -if _engine.dialect.name in ['oracle', 'mysql', 'postgresql']: - _insp = inspect(_engine) - if _engine.dialect.name in ['oracle', 'postgresql'] or BASE.metadata.schema in _insp.get_schema_names(): - if 'distances' in _insp.get_table_names(schema=BASE.metadata.schema): - if any(c['name'] == 'ranking' for c in _insp.get_columns(table_name='distances', schema=BASE.metadata.schema)): - _distance_column_name = 'ranking' - - class Distance(BASE, ModelBase): """Represents distance between rses""" __tablename__ = 'distances' src_rse_id: Mapped[uuid.UUID] = mapped_column(GUID()) dest_rse_id: Mapped[uuid.UUID] = mapped_column(GUID()) - distance: Mapped[Optional[int]] = mapped_column(Integer(), name=_distance_column_name) + distance: Mapped[Optional[int]] = mapped_column(Integer(), name='distance') _table_args = (PrimaryKeyConstraint('src_rse_id', 'dest_rse_id', name='DISTANCES_PK'), ForeignKeyConstraint(['src_rse_id'], ['rses.id'], name='DISTANCES_SRC_RSES_FK'), ForeignKeyConstraint(['dest_rse_id'], ['rses.id'], name='DISTANCES_DEST_RSES_FK'),