\connect - postgres
CREATE SEQUENCE "media_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
SELECT nextval ('"media_id_seq"');
CREATE SEQUENCE "media_folder_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
SELECT nextval ('"media_folder_id_seq"');
CREATE SEQUENCE "creator_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
SELECT nextval ('"creator_id_seq"');
CREATE SEQUENCE "feature_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
SELECT nextval ('"feature_id_seq"');
CREATE SEQUENCE "topic_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
SELECT nextval ('"topic_id_seq"');
CREATE SEQUENCE "webdb_users_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
SELECT nextval ('"webdb_users_id_seq"');
CREATE SEQUENCE "comment_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
SELECT nextval ('"comment_id_seq"');
CREATE SEQUENCE "breaking_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
SELECT nextval ('"breaking_id_seq"');
CREATE SEQUENCE "messages_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
SELECT nextval ('"messages_id_seq"');
CREATE TABLE "media_folder" (
	"id" int4 DEFAULT nextval('media_folder_id_seq'::text) NOT NULL,
	"name" character varying(255) NOT NULL,
	"date" character(8) NOT NULL,
	"place" character varying(80),
	"keywords" text,
	"comment" text,
	"webdb_create" timestamp NOT NULL,
	"webdb_lastchange" timestamp
);
CREATE TABLE "media_type" (
	"id" int2 NOT NULL,
	"name" character varying(80) NOT NULL,
	"classname" character varying(80) NOT NULL,
	"tablename" character varying(80) NOT NULL,
	"dcname" character varying(20)
);
CREATE TABLE "img_format" (
	"id" int2 NOT NULL,
	"name" character varying(20) NOT NULL,
	"extension" character varying(10) NOT NULL,
	"mimetype" character varying(40) NOT NULL,
	"commment" character varying(255)
);
CREATE TABLE "img_layout" (
	"id" int2 NOT NULL,
	"name" character varying(20) NOT NULL
);
CREATE TABLE "img_type" (
	"id" int2 NOT NULL,
	"name" character varying(30) NOT NULL
);
CREATE TABLE "img_color" (
	"id" int2 NOT NULL,
	"name" character varying(30) NOT NULL
);
CREATE TABLE "language" (
	"id" int4 NOT NULL,
	"name" character varying(40) NOT NULL,
	"code" character varying(2) NOT NULL,
	PRIMARY KEY ("id")
);
CREATE TABLE "rights" (
	"id" int4 NOT NULL,
	"name" character varying(80) NOT NULL,
	"description" text,
	PRIMARY KEY ("id")
);
CREATE TABLE "creator" (
	"id" int4 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),
	PRIMARY KEY ("id")
);
CREATE TABLE "feature" (
	"id" int4 DEFAULT nextval('feature_id_seq'::text) NOT NULL,
	"title" character varying(80) NOT NULL,
	"description" text,
	"filename" character varying(20) NOT NULL,
	"main_url" character varying(255),
	"is_published" bool DEFAULT '0' NOT NULL,
	PRIMARY KEY ("id")
);
CREATE TABLE "webdb_users" (
	"id" int4 DEFAULT nextval('webdb_users_id_seq'::text) NOT NULL,
	"login" character varying(16) NOT NULL,
	"password" character varying(16) NOT NULL,
	"is_admin" bool DEFAULT '0' NOT NULL,
	PRIMARY KEY ("id")
);
CREATE TABLE "content_x_topic" (
	"content_id" int4 NOT NULL,
	"topic_id" int4 NOT NULL
);
CREATE TABLE "article_type" (
	"id" int4 NOT NULL,
	"name" character varying(20) NOT NULL
);
CREATE TABLE "topic" (
	"id" int4 DEFAULT nextval('topic_id_seq'::text) NOT NULL,
	"parent_id" int4 DEFAULT '0' NOT NULL,
	"title" character varying(80) NOT NULL,
	"description" text,
	"filename" character varying(20) NOT NULL,
	"main_url" character varying(255),
	"archiv_url" character varying(255),
	PRIMARY KEY ("id")
);
CREATE TABLE "comment" (
	"id" int4 DEFAULT nextval('comment_id_seq'::text) NOT NULL,
	"title" character varying(80) NOT NULL,
	"creator" character varying(80) NOT NULL,
	"description" text NOT NULL,
	"main_url" character varying(255),
	"email" character varying(80),
	"address" character varying(80),
	"phone" character varying(20),
	"webdb_create" timestamp NOT NULL,
	"is_published" bool DEFAULT '1' NOT NULL,
	"to_language" int4 DEFAULT '0' NOT NULL,
	"to_media" int4 NOT NULL,
	PRIMARY KEY ("id")
);
CREATE TABLE "media" (
	"id" int4 DEFAULT nextval('media_id_seq'::text) NOT NULL,
	"title" character varying(80) NOT NULL,
	"subtitle" character varying(30),
	"edittitle" character varying(30),
	"date" character(8) NOT NULL,
	"place" character varying(80),
	"creator" character varying(80),
	"creator_main_url" character varying(255),
	"creator_email" character varying(80),
	"creator_address" character varying(80),
	"creator_phone" character varying(20),
	"description" text,
	"keywords" text,
	"comment" text,
	"source" character varying(255),
	"publish_date" timestamp,
	"publish_server" character varying(255),
	"publish_path" character varying(255),
	"is_published" bool DEFAULT '0' NOT NULL,
	"to_feature" int4 DEFAULT '0' NOT NULL,
	"to_media_folder" int4 DEFAULT '0' NOT NULL,
	"to_media_type" int2 DEFAULT '0' NOT NULL,
	"to_creator" int4 DEFAULT '0' NOT NULL,
	"to_publisher" int4 NOT NULL,
	"to_language" int4 DEFAULT '0',
	"to_rights" int4 DEFAULT '0',
	"webdb_create" timestamp NOT NULL,
	"webdb_lastchange" timestamp,
	"to_media" int4
);
CREATE TABLE "images" (
	"image_data" oid,
	"icon_data" oid,
	"icon_path" character varying(255),
	"icon_is_produced" bool DEFAULT '0' NOT NULL,
	"year" character varying(40),
	"img_width" int2,
	"img_height" int2,
	"to_img_format" int2 DEFAULT '0' NOT NULL,
	"to_img_layout" int2 DEFAULT '0' NOT NULL,
	"to_img_type" int2 DEFAULT '0' NOT NULL,
	"to_img_color" int2 DEFAULT '0' NOT NULL,
	"icon_width" int2,
	"icon_height" int2
)
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" bool DEFAULT '0' NOT NULL,
	"is_produced" bool DEFAULT '0' NOT NULL,
	"is_stored" bool DEFAULT '0' NOT NULL,
	"is_mail_sent" bool DEFAULT '1' NOT NULL,
	"is_digest_sent" bool DEFAULT '1' NOT NULL,
	"to_article_type" int2 DEFAULT '0' NOT NULL
)
inherits ("media");
CREATE TABLE "breaking" (
	"id" int4 DEFAULT nextval('breaking_id_seq'::text) NOT NULL,
	"text" character varying(255) NOT NULL,
	"webdb_create" timestamp NOT NULL
);
CREATE TABLE "messages" (
	"id" int4 DEFAULT nextval('messages_id_seq'::text) NOT NULL,
	"title" character varying(30),
	"description" character varying(255) NOT NULL,
	"creator" character varying(30) NOT NULL,
	"webdb_create" timestamp NOT NULL
);
CREATE TABLE "videos" (
	"video_data" oid,
	"to_video_type" int2 DEFAULT '0' NOT NULL
)
inherits ("media");
CREATE FUNCTION "plpgsql_call_handler" ( ) RETURNS opaque AS '/usr/lib/postgresql/lib/plpgsql.so' LANGUAGE 'C';
CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' HANDLER "plpgsql_call_handler" LANCOMPILER 'PL/pgSQL';
CREATE  INDEX "idx_comment_to_media" on "comment" using btree ( "to_media" "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_webdb_user_log_pas_is_admin" on "webdb_users" using btree ( "login" "varchar_ops", "password" "varchar_ops", "is_admin" "bool_ops" );
CREATE  INDEX "idx_content_is_stored" on "content" using btree ( "is_stored" "bool_ops" );
CREATE  INDEX "idx_content_is_published__id" on "content" using btree ( "is_published" "bool_ops", "id" "int4_ops" );
CREATE UNIQUE INDEX "idx_content" on "content_x_topic" using btree ( "content_id" "int4_ops", "topic_id" "int4_ops" );
CREATE  INDEX "idx_webdb_user_log_pas" on "webdb_users" using btree ( "login" "varchar_ops", "password" "varchar_ops" );
CREATE UNIQUE INDEX "idx_topic" on "content_x_topic" using btree ( "topic_id" "int4_ops", "content_id" "int4_ops" );
CREATE  INDEX "idx_topic_title" on "topic" using btree ( "title" "varchar_ops" );
CREATE  INDEX "idx_images_is_published__icon_i" on "images" using btree ( "is_published" "bool_ops", "icon_is_produced" "bool_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_images_id" on "images" using btree ( "id" "int4_ops" );
CREATE UNIQUE INDEX "idx_content_id" on "content" using btree ( "id" "int4_ops" );
CREATE UNIQUE INDEX "idx_topic_id" on "topic" using btree ( "id" "int4_ops" );
