Open leendertvanwolfswinkel opened 1 month ago
When I run the migrations with threedi-schema 0.226.4 on Boezemmodel__neerslag, all of the tables you mention are gone after the migration. Can we look at this together when you have time?
Went through this with Leendert and it appears to work.
Update: the tables are removed, but the references to the geometry columns in the geometry_columns
table are not dropped.
A solution could be cleaning up any orphaned references at the end of the migration:
def drop_deleted_geom_column_triggers():
geometry_column_references = []
connection = op.get_bind()
result = connection.execute(sa.text("SELECT * FROM geometry_columns;")).fetchall()
for row in result:
geometry_column_references.append({"table": row[0], "column": row[1]})
for reference in geometry_column_references:
try:
connection.execute(sa.text(f"SELECT {reference['column']} FROM {reference['table']};"))
except sqlalchemy.exc.OperationalError:
connection.execute(sa.text(f"SELECT DiscardGeometryColumn('{reference['table']}', '{reference['column']}';"))
@leendertvanwolfswinkel Margriet says that there is an epic with all the last cleanup things for when the 300 schema migration is almost ready, and suggests that this should go in there.
See for example the Boezemmodel__neerslag schematisation