3
ALTER TABLE project ALTER COLUMN synopsis TYPE TEXT;
4
ALTER TABLE project ALTER COLUMN url TYPE TEXT;
5
ALTER TABLE project ADD COLUMN short_name TEXT NOT NULL;
6
ALTER TABLE project ADD COLUMN name TEXT NOT NULL;
8
CREATE OR REPLACE FUNCTION check_project_namespacing_insertupdate()
13
IF TG_OP = ''UPDATE'' THEN
14
IF NEW.projectsetid = OLD.projectsetid AND NEW.short_name = OLD.short_name THEN
18
SELECT offeringid INTO oid FROM project_set WHERE project_set.projectsetid = NEW.projectsetid;
19
PERFORM 1 FROM project, project_set
20
WHERE project_set.offeringid = oid AND
21
project.projectsetid = project_set.projectsetid AND
22
project.short_name = NEW.short_name;
24
RAISE EXCEPTION ''a project named % already exists in offering ID %'', NEW.short_name, oid;
30
CREATE TRIGGER check_project_namespacing
31
BEFORE INSERT OR UPDATE ON project
32
FOR EACH ROW EXECUTE PROCEDURE check_project_namespacing_insertupdate();
34
ALTER TABLE project_extension ADD COLUMN extensionid SERIAL PRIMARY KEY;
36
ALTER TABLE project_submission ADD COLUMN submissionid SERIAL PRIMARY KEY;
37
ALTER TABLE project_submission ADD COLUMN date_submitted TIMESTAMP NOT NULL;
38
ALTER TABLE project_submission ADD COLUMN submitter INT4 REFERENCES login (loginid) NOT NULL;