1 -- update script 2003-11-25 by Zapata
3 -- * added a comment field for internal comments
4 -- This script will terminate with an error the second time it's run,
5 -- so running this script when it isn't needed is prevented from doing do any harm.
11 ----------------------
13 ALTER TABLE "comment" RENAME TO "comment_old";
14 DROP INDEX comment_pkey;
15 DROP INDEX comment_checksum_index;
16 DROP INDEX idx_comment_to_media;
17 DROP INDEX idx_comment_webdb_create;
18 DROP INDEX idx_comment_tomedia_ispublished;
19 DROP INDEX idx_comment_id;
21 CREATE TABLE "comment" (
22 "id" integer DEFAULT nextval('comment_id_seq'::text) NOT NULL,
23 "title" character varying(80) NOT NULL,
24 "creator" character varying(80) NOT NULL,
25 "description" text NOT NULL,
26 "main_url" character varying(255),
27 "email" character varying(80),
28 "address" character varying(80),
29 "phone" character varying(20),
30 "webdb_create" timestamp with time zone NOT NULL,
31 "webdb_lastchange" timestamp with time zone,
32 "is_published" boolean DEFAULT '1' NOT NULL,
33 "to_language" integer DEFAULT '0' NOT NULL,
34 "to_media" integer NOT NULL,
35 "to_comment_status" smallint,
37 "is_html" boolean DEFAULT '0' NOT NULL,
38 Constraint "comment_pkey" Primary Key ("id")
41 CREATE INDEX "idx_comment_to_media" on "comment" using btree ( "to_media" "int4_ops" );
42 CREATE INDEX idx_comment_webdb_create on comment(webdb_create);
43 CREATE INDEX "idx_comment_tomedia_ispublished" on "comment" using btree ( "to_media" "int4_ops", "is_published" "bool_ops" );
44 CREATE UNIQUE INDEX "idx_comment_id" on "comment" using btree ( "id" "int4_ops" );
46 INSERT INTO "comment" (
85 relowner = (SELECT relowner FROM pg_class WHERE relname='comment_old'),
86 relacl = (SELECT relacl FROM pg_class WHERE relname='comment_old')
90 -- to prevent this script from being run successfully for a second time
91 INSERT INTO comment_old(to_media, description, checksum, title, creator, webdb_create) values(1, '', 1, '', '', now());
93 DROP TABLE comment_old;