fixing typos
[mir.git] / dbscripts / create_pg.sql
index d9ce6ab..4070d46 100755 (executable)
@@ -76,14 +76,18 @@ CREATE SEQUENCE "webdb_users_id_seq" start 1 increment 1 maxvalue 2147483647 min
 
 CREATE TABLE "webdb_users" (
        "id" integer DEFAULT nextval('webdb_users_id_seq'::text) NOT NULL,
-       "login" character varying(16) NOT NULL,
+       "login" character varying(16) UNIQUE NOT NULL,
        "password" character varying(255) NOT NULL,
        "is_admin" boolean DEFAULT '0' NOT NULL,
        "comment" text,
-       Constraint "webdb_users_pkey" Primary Key ("id")
+       "is_disabled" boolean DEFAULT '0' NOT NULL,
+       "email" character varying(255) DEFAULT '' NOT NULL,
+       "profile" text,
+       "webdb_create"  timestamp with time zone NOT NULL,
+       "lastlogin"  timestamp with time zone,
+       CONSTRAINT "webdb_users_pkey" Primary Key ("id")
 );
 
-CREATE  INDEX "idx_webdb_user_log_pas_is_admin" on "webdb_users" using btree ( "login" "varchar_ops", "password" "varchar_ops", "is_admin" "bool_ops" );
 
 --
 -- article type
@@ -115,7 +119,6 @@ CREATE TABLE "topic" (
 );
 
 CREATE        INDEX "idx_topic_title" on "topic"           using btree ( "title" "varchar_ops" );
-CREATE UNIQUE INDEX "idx_topic_id"    on "topic"           using btree ( "id" "int4_ops" );
 
 
 -- 
@@ -150,16 +153,14 @@ CREATE TABLE "comment" (
   "to_language" integer DEFAULT '0' NOT NULL,
   "to_media" integer NOT NULL,
   "to_comment_status" smallint,
-  "checksum" integer,
+       "comment" text,
   "is_html" boolean DEFAULT '0' NOT NULL,
   Constraint "comment_pkey" Primary Key ("id")
 );
 
-CREATE        INDEX "comment_checksum_index" on "comment" using btree ( "checksum" "int4_ops" );
 CREATE        INDEX "idx_comment_to_media" on "comment" using btree ( "to_media" "int4_ops" );
 CREATE        INDEX idx_comment_webdb_create on comment(webdb_create);
 CREATE        INDEX "idx_comment_tomedia_ispublished" on "comment" using btree ( "to_media" "int4_ops", "is_published" "bool_ops" );
-CREATE UNIQUE INDEX "idx_comment_id" on "comment" using btree ( "id" "int4_ops" );
 
 
 
@@ -177,7 +178,12 @@ CREATE UNIQUE INDEX "idx_comment_id" on "comment" using btree ( "id" "int4_ops"
 --
 
 CREATE SEQUENCE "media_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
-CREATE TABLE "media" (
+
+--
+-- uploaded_media
+--
+
+CREATE TABLE "uploaded_media" (
        "id" integer DEFAULT nextval('media_id_seq'::text) NOT NULL,
        "title" character varying(255),
        "subtitle" character varying(255),
@@ -191,12 +197,10 @@ CREATE TABLE "media" (
        "description" text,
        "comment" text,
        "source" character varying(255),
-       "publish_date" timestamp with time zone,
        "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_publisher" integer NOT NULL,
@@ -204,19 +208,11 @@ CREATE TABLE "media" (
        "to_rights" integer DEFAULT '0',
        "webdb_create" timestamp with time zone NOT NULL,
        "webdb_lastchange" timestamp with time zone,
-       "to_media" integer
-);
-
---
--- uploaded_media
---
-
-CREATE TABLE "uploaded_media" (
        "icon_is_produced" boolean DEFAULT '0' NOT NULL,
        "icon_path" character varying(255),
-       "size" integer
-)
-INHERITS ("media");
+       "size" integer,
+       Constraint "uploaded_media_pkey" Primary Key ("id")
+);
 
 CREATE UNIQUE INDEX "idx_uploaded_media_id" on "uploaded_media" using btree ( "id" "int4_ops" );
 CREATE UNIQUE INDEX "idx_uploaded_media_is_published" on "uploaded_media" using btree ( "id" "int4_ops", "is_published" "bool_ops" );
@@ -226,8 +222,8 @@ CREATE UNIQUE INDEX "idx_uploaded_media_is_published" on "uploaded_media" using
 --
 
 CREATE TABLE "images" (
-       "image_data" oid,
-       "icon_data" oid,
+       "image_data" bytea,
+       "icon_data" bytea,
        "year" character varying(40),
        "img_width" smallint,
        "img_height" smallint,
@@ -240,7 +236,7 @@ CREATE TABLE "images" (
 )
 INHERITS ("uploaded_media");
 
-CREATE        INDEX "idx_images_is_published__icon_i" on "images" using btree ( "is_published" "bool_ops", "icon_is_produced" "bool_ops" );
+CREATE        INDEX "idx_images_is_published" on "images" using btree ( "is_published" "bool_ops", "icon_is_produced" "bool_ops" );
 CREATE UNIQUE INDEX "idx_images_id" on "images" using btree ( "id" "int4_ops" );
 
         --
@@ -322,21 +318,41 @@ CREATE UNIQUE INDEX "idx_othermedia_id" on "other_media" using btree ( "id" "int
 --
 
 CREATE TABLE "content" (
+       "id" integer DEFAULT nextval('media_id_seq'::text) NOT NULL,
+       "title" character varying(255),
+       "subtitle" character varying(255),
+       "edittitle" character varying(255),
+       "date" character(8) NOT NULL,
+       "creator" character varying(80),
+       "creator_main_url" character varying(255),
+       "creator_email" character varying(80),
+       "creator_address" character varying(80),
+       "creator_phone" character varying(80),
+       "description" text,
+       "comment" text,
+       "source" character varying(255),
+       "is_published" boolean DEFAULT '0' NOT NULL,
+       "is_produced" boolean DEFAULT '0' NOT NULL,
+       "to_publisher" integer NOT NULL,
+       "to_language" integer DEFAULT '0',
+       "to_rights" integer DEFAULT '0',
+       "webdb_create" timestamp with time zone NOT NULL,
+       "webdb_lastchange" timestamp with time zone,
        "content_data" text,
        "is_html" boolean DEFAULT '0' NOT NULL,
        "to_article_type" smallint DEFAULT '0' NOT NULL,
        "to_content" integer,
-       "checksum" integer
-)
-INHERITS ("media");
+       "keywords" text,
+       "to_locking_user" integer,
+  Constraint "content_pkey" Primary Key ("id")
+);
+
 
-CREATE        INDEX "content_checksum_index" on "content" using btree ( "checksum" "int4_ops" );
 CREATE        INDEX "idx_content_to_article_type" on "content" using btree ( "to_article_type" "int2_ops" );
 CREATE        INDEX "idx_content_is_produced" on "content" using btree ( "is_produced" "bool_ops" );
 CREATE        INDEX "idx_content_is_published__to_ar" on "content" using btree ( "is_published" "bool_ops", "to_article_type" "int2_ops" );
 CREATE        INDEX "idx_content_is_published__id" on "content" using btree ( "is_published" "bool_ops", "id" "int4_ops" );
 CREATE        INDEX "idx_content_is_pub__to_art__to_" on "content" using btree ( "is_published" "bool_ops", "to_article_type" "int2_ops", "id" "int4_ops" );
-CREATE UNIQUE INDEX "idx_content_id" on "content" using btree ( "id" "int4_ops" );
 CREATE        INDEX "idx_content_is_published" on "content" using btree ( "is_published" "bool_ops" );
 CREATE        INDEX idx_content_webdb_create on content(webdb_create);
 
@@ -348,8 +364,8 @@ CREATE        INDEX idx_content_webdb_create on content(webdb_create);
       "media_id" integer
     );
 
-    CREATE UNIQUE INDEX "idx_content_media" on "content_x_media" using btree ( "content_id" "int4_ops", "media_id" "int4_ops" );
-    CREATE UNIQUE INDEX "idx_media_content" on "content_x_media" using btree ( "media_id" "int4_ops", "content_id" "int4_ops" );
+    CREATE INDEX "idx_cxm_content" on "content_x_media" using btree ( "content_id" "int4_ops" );
+    CREATE INDEX "idx_cxm_media" on "content_x_media" using btree ( "media_id" "int4_ops" );
 
 --
 -- breaking
@@ -377,3 +393,55 @@ CREATE TABLE "messages" (
   "webdb_create" timestamp with time zone NOT NULL
 );
 
+
+--
+-- filter
+--
+
+CREATE SEQUENCE "filter_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
+
+CREATE TABLE "filter" (
+  "id" integer DEFAULT nextval('filter_id_seq'::text) NOT NULL,
+  "priority" integer,
+  "filter_group_id" integer,
+  "type" character varying(255) NOT NULL,
+  "expression" character varying(255) NOT NULL,
+  "tag" character varying(255) NOT NULL,
+       "comment" text,
+  "articleaction" character varying(255) NOT NULL,
+  "commentaction" character varying(255) NOT NULL,
+       "last_hit" timestamp with time zone
+);
+
+--
+-- filter_group
+--
+
+CREATE SEQUENCE "filter_group_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
+
+CREATE TABLE "filter_group" (
+  "id" integer DEFAULT nextval('filter_group_id_seq'::text) NOT NULL,
+  "name" character varying(255),
+  "priority" integer
+);
+
+--
+-- db_patches
+--
+
+CREATE SEQUENCE "db_patches_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
+
+CREATE TABLE "db_patches" (
+  "id" integer DEFAULT nextval('db_patches_id_seq'::text) NOT NULL,
+  "date" date NOT NULL,
+  "description" text
+);
+
+--
+-- model_version
+--
+
+CREATE TABLE "model_version" (
+  "description"  character varying(24)
+);
+