1- # app/utils/migrations.py
21import hashlib
32
43from app .schemas .classification_schemas import Classification
@@ -224,7 +223,6 @@ def create_migrations(
224223
225224 for c in classifications :
226225 table_name = _table_name_for_classification (c )
227- qualified_table_name = f"{ schema_name } .{ table_name } "
228226 mig_name = f"create_table_{ schema_name } _{ table_name } "
229227
230228 if mig_name in existing_names :
@@ -266,9 +264,6 @@ def create_migrations(
266264 ):
267265 continue
268266
269- qualified_from = f"{ schema_name } .{ from_table } "
270- qualified_to = f"{ schema_name } .{ to_table } "
271-
272267 # Support both Enum and plain string for rel.type
273268 raw_type = getattr (rel .type , "value" , rel .type )
274269 rel_type_norm = str (raw_type ).upper ().replace ("-" , "_" )
@@ -290,7 +285,7 @@ def create_migrations(
290285BEGIN
291286 ALTER TABLE "{ schema_name } "."{ from_table } "
292287 ADD COLUMN IF NOT EXISTS "{ to_table } _id" UUID;
293-
288+
294289 IF NOT EXISTS (
295290 SELECT 1 FROM pg_constraint c
296291 JOIN pg_namespace n ON c.connamespace = n.oid
@@ -321,7 +316,7 @@ def create_migrations(
321316BEGIN
322317 ALTER TABLE "{ schema_name } "."{ from_table } "
323318 ADD COLUMN IF NOT EXISTS "{ to_table } _id" UUID;
324-
319+
325320 -- Add FK constraint if not exists
326321 IF NOT EXISTS (
327322 SELECT 1 FROM pg_constraint c
@@ -334,7 +329,7 @@ def create_migrations(
334329 FOREIGN KEY ("{ to_table } _id")
335330 REFERENCES "{ schema_name } "."{ to_table } "(id);
336331 END IF;
337-
332+
338333 -- Add UNIQUE constraint if not exists
339334 IF NOT EXISTS (
340335 SELECT 1 FROM pg_constraint c
0 commit comments