Skip to content

Commit

Permalink
fix foreign key thingy
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfsayo committed Feb 22, 2024
1 parent afa5312 commit 2f2aea3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,39 +1,3 @@
table:
name: referrer_types
schema: public
is_enum: true
array_relationships:
- name: consultations
using:
manual_configuration:
column_mapping:
referrer_type: referrer
insertion_order: null
remote_table:
name: consultations
schema: public
select_permissions:
- role: cohort
permission:
columns:
- referrer_type
filter: {}
comment: ""
- role: member
permission:
columns:
- referrer_type
filter: {}
comment: ""
- role: public
permission:
columns:
- referrer_type
filter: {}
comment: ""
- role: user
permission:
columns:
- referrer_type
filter: {}
comment: ""
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE "public"."referrer_types" (
"referrer_type" text NOT NULL,
"referrer_type" TEXT NOT NULL,
PRIMARY KEY ("referrer_type")
);
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ALTER TABLE consultations
ADD COLUMN referrer referrer_types DEFAULT NULL;
ADD COLUMN referrer TEXT DEFAULT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- First, drop the existing constraint if it exists
ALTER TABLE public.consultations
DROP CONSTRAINT IF EXISTS "fk_consultations_referrer";

-- Then, add the foreign key constraint
ALTER TABLE public.consultations
ADD CONSTRAINT "fk_consultations_referrer"
FOREIGN KEY ("referrer")
REFERENCES public.referrer_types(referrer_type);

0 comments on commit 2f2aea3

Please sign in to comment.