Skip to content

Commit

Permalink
Move foreign key to end of schema
Browse files Browse the repository at this point in the history
  • Loading branch information
thokra-nav committed Feb 19, 2024
1 parent 9629bcc commit 0b52860
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/database/migrations/0001_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ CREATE TABLE audit_logs (
CREATE TABLE cost (
id serial PRIMARY KEY,
environment text,
team_slug slug REFERENCES teams(slug) ON DELETE CASCADE,
team_slug slug,
app text NOT NULL,
cost_type text NOT NULL,
date date NOT NULL,
Expand Down Expand Up @@ -337,6 +337,9 @@ ALTER TABLE user_roles
ALTER TABLE vulnerability_metrics
ADD FOREIGN KEY (dependencytrack_project_id) REFERENCES dependencytrack_projects(id) ON DELETE CASCADE;

ALTER TABLE cost
ADD FOREIGN KEY (team_slug) REFERENCES teams(slug) ON DELETE CASCADE;

-- triggers
CREATE TRIGGER reconciler_states_set_updated BEFORE
UPDATE
Expand Down

0 comments on commit 0b52860

Please sign in to comment.