Added index creation to database creation script.
[mir.git] / dbscripts / create_pg.sql
index 86bd687..9173fdf 100755 (executable)
@@ -19,14 +19,6 @@ CREATE SEQUENCE "media_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue
 CREATE SEQUENCE "media_folder_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
 
 --
--- TOC Entry ID 4 (OID 28752)
---
--- Name: creator_id_seq Type: SEQUENCE Owner: postgres
---
-
-CREATE SEQUENCE "creator_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
-
---
 -- TOC Entry ID 5 (OID 28771)
 --
 -- Name: feature_id_seq Type: SEQUENCE Owner: postgres
@@ -188,22 +180,6 @@ CREATE TABLE "rights" (
 );
 
 --
--- TOC Entry ID 20 (OID 29024)
---
--- Name: creator Type: TABLE Owner: postgres
---
-
-CREATE TABLE "creator" (
-       "id" integer DEFAULT nextval('creator_id_seq'::text) NOT NULL,
-       "name" character varying(80) NOT NULL,
-       "main_url" character varying(255),
-       "email" character varying(80),
-       "address" character varying(80),
-       "phone" character varying(20),
-       Constraint "creator_pkey" Primary Key ("id")
-);
-
---
 -- TOC Entry ID 21 (OID 29043)
 --
 -- Name: feature Type: TABLE Owner: postgres
@@ -292,9 +268,12 @@ CREATE TABLE "comment" (
        "to_language" integer DEFAULT '0' NOT NULL,
        "to_media" integer NOT NULL,
        "to_comment_status" smallint,
+       "checksum" integer, 
        Constraint "comment_pkey" Primary Key ("id")
 );
 
+CREATE INDEX comment_checksum_index ON comment (checksum);
+
 --
 -- TOC Entry ID 27 (OID 29196)
 --
@@ -321,10 +300,10 @@ CREATE TABLE "media" (
        "publish_server" character varying(255),
        "publish_path" character varying(255),
        "is_published" boolean DEFAULT '0' NOT NULL,
+       "is_produced" boolean DEFAULT '0' NOT NULL,
        "to_feature" integer DEFAULT '0' NOT NULL,
        "to_media_folder" integer DEFAULT '0' NOT NULL,
        "to_media_type" smallint DEFAULT '0' NOT NULL,
-       "to_creator" integer DEFAULT '0' NOT NULL,
        "to_publisher" integer NOT NULL,
        "to_language" integer DEFAULT '0',
        "to_rights" integer DEFAULT '0',
@@ -339,11 +318,21 @@ CREATE TABLE "media" (
 -- Name: images Type: TABLE Owner: postgres
 --
 
+--
+-- TOC Entry ID 32 (OID 29446)
+--
+-- Name: uploaded_media Type: TABLE Owner: postgres
+--
+
+CREATE TABLE "uploaded_media" (
+       "icon_is_produced" boolean DEFAULT '0' NOT NULL,
+       "icon_path" character varying(255),
+    "size" integer
+) INHERITS ("media");
+
 CREATE TABLE "images" (
        "image_data" oid,
        "icon_data" oid,
-       "icon_path" character varying(255),
-       "icon_is_produced" boolean DEFAULT '0' NOT NULL,
        "year" character varying(40),
        "img_width" smallint,
        "img_height" smallint,
@@ -354,7 +343,7 @@ CREATE TABLE "images" (
        "icon_width" smallint,
        "icon_height" smallint
 )
-INHERITS ("media");
+INHERITS ("uploaded_media");
 
 --
 -- TOC Entry ID 29 (OID 29338)
@@ -365,19 +354,18 @@ INHERITS ("media");
 CREATE TABLE "content" (
        "content_data" text,
        "link_url" character varying(255),
-       "date_from" character varying(8),
-       "date_to" character varying(8),
-       "date_name" character varying(255),
        "is_html" boolean DEFAULT '0' NOT NULL,
-       "is_produced" boolean DEFAULT '0' NOT NULL,
        "is_stored" boolean DEFAULT '0' NOT NULL,
        "is_mail_sent" boolean DEFAULT '1' NOT NULL,
        "is_digest_sent" boolean DEFAULT '1' NOT NULL,
        "to_article_type" smallint DEFAULT '0' NOT NULL,
-       "to_content" integer
+       "to_content" integer,
+       "checksum" integer
 )
 INHERITS ("media");
 
+CREATE INDEX content_checksum_index ON content (checksum);
+
 --
 -- TOC Entry ID 30 (OID 29418)
 --
@@ -405,16 +393,6 @@ CREATE TABLE "messages" (
 );
 
 --
--- TOC Entry ID 32 (OID 29446)
---
--- Name: uploaded_media Type: TABLE Owner: postgres
---
-
-CREATE TABLE "uploaded_media" (
-) INHERITS ("media");
-
---
 -- TOC Entry ID 33 (OID 30026)
 --
 -- Name: comment_status Type: TABLE Owner: postgres