Boost Azure Demo
This commit is contained in:
22
Backend/db/migrations/008_assignment_pass_threshold.sql
Normal file
22
Backend/db/migrations/008_assignment_pass_threshold.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- +goose Up
|
||||
|
||||
ALTER TABLE assignments
|
||||
ADD COLUMN pass_threshold NUMERIC(5,2) NOT NULL DEFAULT 8.00,
|
||||
ADD CONSTRAINT assignments_pass_threshold_range_check
|
||||
CHECK (pass_threshold >= 0 AND pass_threshold <= 10);
|
||||
|
||||
UPDATE assignments a
|
||||
SET pass_threshold = COALESCE(
|
||||
(
|
||||
SELECT MAX(aa.pass_threshold)
|
||||
FROM assignment_assignees aa
|
||||
WHERE aa.assignment_id = a.id
|
||||
),
|
||||
8.00
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
|
||||
ALTER TABLE assignments
|
||||
DROP CONSTRAINT IF EXISTS assignments_pass_threshold_range_check,
|
||||
DROP COLUMN IF EXISTS pass_threshold;
|
||||
Reference in New Issue
Block a user