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
This commit is contained in:
parent
2fb81a6d1a
commit
254d7c3216
1 changed files with 5 additions and 4 deletions
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS job_payments (
|
CREATE TABLE IF NOT EXISTS job_payments (
|
||||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
job_id UUID NOT NULL,
|
job_id INT NOT NULL,
|
||||||
user_id UUID,
|
user_id INT,
|
||||||
|
|
||||||
-- Stripe
|
-- Stripe
|
||||||
stripe_session_id VARCHAR(255),
|
stripe_session_id VARCHAR(255),
|
||||||
|
|
@ -39,8 +39,9 @@ CREATE TABLE IF NOT EXISTS job_payments (
|
||||||
paid_at TIMESTAMP,
|
paid_at TIMESTAMP,
|
||||||
expires_at TIMESTAMP,
|
expires_at TIMESTAMP,
|
||||||
|
|
||||||
-- Foreign key (UUID to match jobs table)
|
-- Foreign key (INT to match jobs.id SERIAL)
|
||||||
FOREIGN KEY (job_id) REFERENCES jobs(id) ON DELETE CASCADE
|
FOREIGN KEY (job_id) REFERENCES jobs(id) ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Indexes
|
-- Indexes
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue