Skip to content

Commit

Permalink
add foreign key to seen_sources.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
pranav-super committed Oct 4, 2024
1 parent 2be6d82 commit 6d5e9e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ table:
schema: ui
configuration:
custom_name: "seen_sources"
object_relationships:
- name: external_source
using:
foreign_key_constraint_on:
- source_key
- derivation_group_name
select_permissions:
- role: aerie_admin
permission:
Expand Down
6 changes: 5 additions & 1 deletion deployment/postgres-init-db/sql/tables/ui/seen_sources.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ create table ui.seen_sources
username text not null,
external_source_name text not null,
derivation_group text not null,
external_source_type text not null, -- included for ease of filtering
external_source_type text not null, -- included for ease of filtering in the UI

constraint seen_sources_pkey
primary key (username, external_source_name, derivation_group),
constraint seen_sources_references_user
foreign key (username)
references permissions.users (username) match simple
on delete cascade,
constraint seen_sources_references_external_source
foreign key (external_source_name, derivation_group)
references merlin.external_source (key, derivation_group_name) match simple
on delete cascade
);

Expand Down

0 comments on commit 6d5e9e5

Please sign in to comment.