From 254d7c3216ca2f4231ab9a2f1c57b759db5f485d Mon Sep 17 00:00:00 2001 From: Tiago Yamamoto Date: Wed, 24 Dec 2025 10:49:33 -0300 Subject: [PATCH] fix(migrations): change job_payments FK types from UUID to INT - job_id changed from UUID to INT to match jobs.id SERIAL - user_id changed from UUID to INT to match users.id SERIAL - Added user_id FK to users table --- backend/migrations/019_create_job_payments_table.sql | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/migrations/019_create_job_payments_table.sql b/backend/migrations/019_create_job_payments_table.sql index 128bf6f..1f74766 100644 --- a/backend/migrations/019_create_job_payments_table.sql +++ b/backend/migrations/019_create_job_payments_table.sql @@ -3,8 +3,8 @@ CREATE TABLE IF NOT EXISTS job_payments ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), - job_id UUID NOT NULL, - user_id UUID, + job_id INT NOT NULL, + user_id INT, -- Stripe stripe_session_id VARCHAR(255), @@ -39,8 +39,9 @@ CREATE TABLE IF NOT EXISTS job_payments ( paid_at TIMESTAMP, expires_at TIMESTAMP, - -- Foreign key (UUID to match jobs table) - FOREIGN KEY (job_id) REFERENCES jobs(id) ON DELETE CASCADE + -- Foreign key (INT to match jobs.id SERIAL) + FOREIGN KEY (job_id) REFERENCES jobs(id) ON DELETE CASCADE, + FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL ); -- Indexes