Skip to content

Commit

Permalink
364 ticket, changed subgoal to benchmark (#381)
Browse files Browse the repository at this point in the history
* changed subgoal to benchmark

* fixed errors

* remove unnecessary commas differing with main, run prettier

* run prettier, check tests all passing

* replace 'subgoal' with 'benchmark' in remaining files which did not cause conflict on merge, correct variable name in iep test from incorrect replacement in merge

---------

Co-authored-by: Connor Wales <connorwales@gmail.com>
Co-authored-by: KCCPMG <39074889+KCCPMG@users.noreply.github.com>
Co-authored-by: Katrina Connors <32425204+katconnors@users.noreply.github.com>
  • Loading branch information
4 people authored Nov 2, 2024
1 parent 41f0d6c commit 406cf35
Show file tree
Hide file tree
Showing 19 changed files with 1,061 additions and 1,058 deletions.
9 changes: 4 additions & 5 deletions src/backend/db/migrations/1_initial-migrations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ CREATE TABLE "goal" (
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

-- aka benchmark
CREATE TABLE "subgoal" (
subgoal_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), -- TODO: add index to allow reordering
CREATE TABLE "benchmark" (
benchmark_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), -- TODO: add index to allow reordering
goal_id UUID REFERENCES "goal" (goal_id),
status TEXT NOT NULL DEFAULT 'In Progress'
CHECK (status IN ('In Progress', 'Complete')),
Expand All @@ -101,7 +100,7 @@ CREATE TABLE "subgoal" (

CREATE TABLE "task" (
task_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
subgoal_id UUID REFERENCES "subgoal" (subgoal_id),
benchmark_id UUID REFERENCES "benchmark" (benchmark_id),
assignee_id UUID REFERENCES "user" (user_id),
due_date TIMESTAMPTZ,
trial_count INTEGER,
Expand Down Expand Up @@ -129,5 +128,5 @@ CREATE TABLE "trial_data_file" (
);

-- Potential schema for different collection types:
-- type TEXT NOT NULL CHECK (type IN ('attempt', 'behavioral')) -- enum - type of subgoal
-- type TEXT NOT NULL CHECK (type IN ('attempt', 'behavioral')) -- enum - type of benchmark
-- data jsonb -- actual data, e.g. attempt_counts etc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Each task should have a unique subgoal_id - assignee_id combination
-- Each task should have a unique benchmark_id - assignee_id combination
-- which corresponds to a unique benchmark / para combo
ALTER TABLE task
ADD CONSTRAINT subgoal_assignee_unique UNIQUE (subgoal_id, assignee_id);
ADD CONSTRAINT benchmark_assignee_unique UNIQUE (benchmark_id, assignee_id);

-- Add index to allow easy queries of tasks by assignee
CREATE INDEX idx_task_assignee ON task(assignee_id);
Loading

0 comments on commit 406cf35

Please sign in to comment.