fix(db): point verification_logs FK at verifications, not legacy verification_requests
Some checks failed
build-and-release / build (gateway) (push) Successful in 55s
build-and-release / build (graphic-designers) (push) Successful in 2m13s
build-and-release / build (social-media-managers) (push) Has been cancelled
build-and-release / build (video-editors) (push) Has been cancelled
build-and-release / build (employees) (push) Successful in 2m0s
build-and-release / build (developers) (push) Successful in 2m43s
build-and-release / build (leads) (push) Successful in 1m49s
build-and-release / build (photographers) (push) Successful in 2m17s
build-and-release / build (tutors) (push) Has been cancelled
build-and-release / build (cron) (push) Successful in 47s
build-and-release / build (companies) (push) Successful in 2m6s
build-and-release / build (jobs) (push) Successful in 44s
build-and-release / build (customers) (push) Successful in 2m12s
build-and-release / build (fitness-trainers) (push) Successful in 2m20s
build-and-release / build (payments) (push) Successful in 2m45s
build-and-release / build (makeup-artists) (push) Successful in 3m10s
build-and-release / build (users) (push) Has been cancelled
build-and-release / build (ugc-content-creators) (push) Has been cancelled
build-and-release / build (catering-services) (push) Successful in 1m36s
build-and-release / build (job-seekers) (push) Successful in 2m22s
Some checks failed
build-and-release / build (gateway) (push) Successful in 55s
build-and-release / build (graphic-designers) (push) Successful in 2m13s
build-and-release / build (social-media-managers) (push) Has been cancelled
build-and-release / build (video-editors) (push) Has been cancelled
build-and-release / build (employees) (push) Successful in 2m0s
build-and-release / build (developers) (push) Successful in 2m43s
build-and-release / build (leads) (push) Successful in 1m49s
build-and-release / build (photographers) (push) Successful in 2m17s
build-and-release / build (tutors) (push) Has been cancelled
build-and-release / build (cron) (push) Successful in 47s
build-and-release / build (companies) (push) Successful in 2m6s
build-and-release / build (jobs) (push) Successful in 44s
build-and-release / build (customers) (push) Successful in 2m12s
build-and-release / build (fitness-trainers) (push) Successful in 2m20s
build-and-release / build (payments) (push) Successful in 2m45s
build-and-release / build (makeup-artists) (push) Successful in 3m10s
build-and-release / build (users) (push) Has been cancelled
build-and-release / build (ugc-content-creators) (push) Has been cancelled
build-and-release / build (catering-services) (push) Successful in 1m36s
build-and-release / build (job-seekers) (push) Successful in 2m22s
scripts/init-db.sql created verification_logs.verification_request_id with a foreign key against verification_requests(id) - an unrelated legacy table. VerificationRepository::update_status inserts the verifications.id (the row actually being approved/rejected) into that column on every status change, which has been violating the FK on every single call: "insert or update on table verification_logs violates foreign key constraint verification_logs_verification_request_id_fkey" This made every Approve/Reject click in Verification Management 500, confirmed via the browser's actual response body. Drop and recreate the constraint to point at verifications(id), which is what the code has always actually been logging against. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
a0d97583c4
commit
466e7abf03
2 changed files with 24 additions and 0 deletions
|
|
@ -0,0 +1,8 @@
|
|||
BEGIN;
|
||||
|
||||
ALTER TABLE verification_logs DROP CONSTRAINT IF EXISTS verification_logs_verification_request_id_fkey;
|
||||
ALTER TABLE verification_logs
|
||||
ADD CONSTRAINT verification_logs_verification_request_id_fkey
|
||||
FOREIGN KEY (verification_request_id) REFERENCES verification_requests(id) ON DELETE CASCADE;
|
||||
|
||||
COMMIT;
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
-- verification_logs.verification_request_id was mistakenly created (init-db.sql)
|
||||
-- referencing the legacy, unrelated verification_requests table instead of the
|
||||
-- verifications table it actually logs against. VerificationRepository::update_status
|
||||
-- inserts the verifications.id into this column on every approve/reject/status-change
|
||||
-- call, which has been violating the foreign key constraint on every single call
|
||||
-- ("insert or update on table verification_logs violates foreign key constraint
|
||||
-- verification_logs_verification_request_id_fkey"), making Approve/Reject 500 every time.
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE verification_logs DROP CONSTRAINT IF EXISTS verification_logs_verification_request_id_fkey;
|
||||
ALTER TABLE verification_logs
|
||||
ADD CONSTRAINT verification_logs_verification_request_id_fkey
|
||||
FOREIGN KEY (verification_request_id) REFERENCES verifications(id) ON DELETE CASCADE;
|
||||
|
||||
COMMIT;
|
||||
Loading…
Add table
Reference in a new issue