dropped name uniqueness between orgs, added constraint to owning lib and name
Includes syntax corrections from Martha Driscoll -- thank you, Martha!
Signed-off-by: malexander <malexander@catalyte.io>
Signed-off-by: Beth Willis <willis@noblenet.org>
Signed-off-by: Jane Sandberg <sandbergja@gmail.com>
CREATE TABLE asset.course_module_term (
id SERIAL PRIMARY KEY,
- name TEXT UNIQUE NOT NULL,
+ name TEXT NOT NULL,
owning_lib INT REFERENCES actor.org_unit (id),
start_date TIMESTAMP WITH TIME ZONE,
- end_date TIMESTAMP WITH TIME ZONE
+ end_date TIMESTAMP WITH TIME ZONE,
+ CONSTRAINT cmt_once_per_owning_lib UNIQUE (owning_lib, name)
);
CREATE TABLE asset.course_module_term_course_map (
--- /dev/null
+BEGIN;\r
+\r
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);\r
+\r
+ALTER TABLE asset.course_module_term\r
+ DROP CONSTRAINT course_module_term_name_key;\r
+\r
+ALTER TABLE asset.course_module_term\r
+ ADD CONSTRAINT cmt_once_per_owning_lib UNIQUE (owning_lib, name);\r
+\r
+COMMIT;\r