Compare commits
No commits in common. "eb3e25b18f84ffc8edcf2a5dfb69dd0ab567ba01" and "b12bac5e345a459ffb3ea7ed078be4802c22049d" have entirely different histories.
eb3e25b18f
...
b12bac5e34
@ -1 +1 @@
|
|||||||
v20260106-20-fix-customer-delete-fk
|
v20260106-19-missed-run-detection-threshold
|
||||||
|
|||||||
@ -1226,37 +1226,6 @@ def migrate_object_persistence_tables() -> None:
|
|||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Ensure existing installations also have ON DELETE CASCADE for customer_object_id.
|
|
||||||
# Older schemas may have created the FK without cascade, blocking customer deletes.
|
|
||||||
conn.execute(
|
|
||||||
text(
|
|
||||||
'''
|
|
||||||
DO $$
|
|
||||||
BEGIN
|
|
||||||
IF EXISTS (
|
|
||||||
SELECT 1
|
|
||||||
FROM information_schema.table_constraints tc
|
|
||||||
WHERE tc.table_name = 'job_object_links'
|
|
||||||
AND tc.constraint_type = 'FOREIGN KEY'
|
|
||||||
AND tc.constraint_name = 'job_object_links_customer_object_id_fkey'
|
|
||||||
) THEN
|
|
||||||
ALTER TABLE job_object_links
|
|
||||||
DROP CONSTRAINT job_object_links_customer_object_id_fkey;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
ALTER TABLE job_object_links
|
|
||||||
ADD CONSTRAINT job_object_links_customer_object_id_fkey
|
|
||||||
FOREIGN KEY (customer_object_id)
|
|
||||||
REFERENCES customer_objects(id)
|
|
||||||
ON DELETE CASCADE;
|
|
||||||
EXCEPTION
|
|
||||||
WHEN duplicate_object THEN
|
|
||||||
NULL;
|
|
||||||
END $$;
|
|
||||||
'''
|
|
||||||
)
|
|
||||||
)
|
|
||||||
conn.execute(
|
conn.execute(
|
||||||
text(
|
text(
|
||||||
'CREATE INDEX IF NOT EXISTS idx_job_object_links_job_id ON job_object_links (job_id)'
|
'CREATE INDEX IF NOT EXISTS idx_job_object_links_job_id ON job_object_links (job_id)'
|
||||||
@ -1284,36 +1253,6 @@ def migrate_object_persistence_tables() -> None:
|
|||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Ensure existing installations also have ON DELETE CASCADE for customer_object_id.
|
|
||||||
conn.execute(
|
|
||||||
text(
|
|
||||||
'''
|
|
||||||
DO $$
|
|
||||||
BEGIN
|
|
||||||
IF EXISTS (
|
|
||||||
SELECT 1
|
|
||||||
FROM information_schema.table_constraints tc
|
|
||||||
WHERE tc.table_name = 'run_object_links'
|
|
||||||
AND tc.constraint_type = 'FOREIGN KEY'
|
|
||||||
AND tc.constraint_name = 'run_object_links_customer_object_id_fkey'
|
|
||||||
) THEN
|
|
||||||
ALTER TABLE run_object_links
|
|
||||||
DROP CONSTRAINT run_object_links_customer_object_id_fkey;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
ALTER TABLE run_object_links
|
|
||||||
ADD CONSTRAINT run_object_links_customer_object_id_fkey
|
|
||||||
FOREIGN KEY (customer_object_id)
|
|
||||||
REFERENCES customer_objects(id)
|
|
||||||
ON DELETE CASCADE;
|
|
||||||
EXCEPTION
|
|
||||||
WHEN duplicate_object THEN
|
|
||||||
NULL;
|
|
||||||
END $$;
|
|
||||||
'''
|
|
||||||
)
|
|
||||||
)
|
|
||||||
conn.execute(
|
conn.execute(
|
||||||
text(
|
text(
|
||||||
'CREATE INDEX IF NOT EXISTS idx_run_object_links_run_id ON run_object_links (run_id)'
|
'CREATE INDEX IF NOT EXISTS idx_run_object_links_run_id ON run_object_links (run_id)'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user