-- --------------------------------------------------------
-- Хост:                         127.0.0.1
-- Версия сервера:               PostgreSQL 9.4.4, compiled by Visual C++ build 1800, 32-bit
-- ОС Сервера:                   
-- HeidiSQL Версия:              9.3.0.4984
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES  */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;

-- Дамп структуры для таблица public.article
CREATE TABLE IF NOT EXISTS "article" (
	"id" INTEGER NOT NULL DEFAULT nextval('article_id_seq'::regclass) COMMENT E'',
	"sort" INTEGER NOT NULL DEFAULT 100 COMMENT E'',
	"create_at" TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now() COMMENT E'',
	"update_at" TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now() COMMENT E'',
	"code" CHARACTER VARYING NOT NULL COMMENT E'',
	"category_id" INTEGER NOT NULL DEFAULT 1 COMMENT E'',
	"author" INTEGER NOT NULL COMMENT E'',
	"tags" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"parent_id" INTEGER NULL DEFAULT NULL COMMENT E'',
	"active" SMALLINT NOT NULL DEFAULT 0 COMMENT E'',
	"comments" SMALLINT NOT NULL DEFAULT 0::smallint COMMENT E'',
	"voting" SMALLINT NOT NULL DEFAULT 0::smallint COMMENT E'',
	KEY ("author"),
	PRIMARY KEY ("id"),
	KEY ("parent_id"),
	KEY ("category_id"),
	KEY ("id")
);

-- Дамп данных таблицы public.article: 3 rows
/*!40000 ALTER TABLE "article" DISABLE KEYS */;
INSERT INTO "article" ("id", "sort", "create_at", "update_at", "code", "category_id", "author", "tags", "parent_id", "active", "comments", "voting") VALUES
	(5, 100, E'2015-12-04 14:52:39.54', E'2015-12-04 14:52:39.54', E'test_article', 1, 1, E'test, tag', NULL, 1, 0, 0),
	(6, 100, E'2015-12-04 14:52:52.403', E'2015-12-04 14:52:52.403', E'test_article2', 1, 1, E'test, tag', NULL, 1, 0, 0),
	(12, 100, E'2015-12-04 14:52:52.403', E'2015-12-04 14:52:52.403', E'test_article3', 1, 1, E'test, tag', 5, 1, 0, 0);
/*!40000 ALTER TABLE "article" ENABLE KEYS */;


-- Дамп структуры для таблица public.article_category
CREATE TABLE IF NOT EXISTS "article_category" (
	"id" INTEGER NOT NULL DEFAULT nextval('article_category_id_seq'::regclass) COMMENT E'',
	"sort" INTEGER NOT NULL DEFAULT 100 COMMENT E'',
	"code" CHARACTER VARYING NOT NULL COMMENT E'',
	"created_at" TIME WITHOUT TIME ZONE NOT NULL DEFAULT now() COMMENT E'',
	"updated_at" TIME WITHOUT TIME ZONE NOT NULL DEFAULT now() COMMENT E'',
	"tags" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"parent_id" INTEGER NULL DEFAULT NULL COMMENT E'',
	"active" SMALLINT NOT NULL DEFAULT 0 COMMENT E'',
	PRIMARY KEY ("id"),
	KEY ("parent_id"),
	KEY ("id")
);

-- Дамп данных таблицы public.article_category: 2 rows
/*!40000 ALTER TABLE "article_category" DISABLE KEYS */;
INSERT INTO "article_category" ("id", "sort", "code", "created_at", "updated_at", "tags", "parent_id", "active") VALUES
	(1, 100, E'static_pages', E'14:08:02.74', E'14:08:02.74', NULL, NULL, 1),
	(2, 100, E'qwerty', E'11:00:35.954', E'11:00:35.954', E'qwerty', NULL, 0);
/*!40000 ALTER TABLE "article_category" ENABLE KEYS */;


-- Дамп структуры для таблица public.article_category_lang
CREATE TABLE IF NOT EXISTS "article_category_lang" (
	"id" INTEGER NOT NULL DEFAULT nextval('article_category_lang_id_seq'::regclass) COMMENT E'',
	"lang_id" INTEGER NOT NULL DEFAULT 0 COMMENT E'',
	"category_id" INTEGER NULL DEFAULT NULL COMMENT E'',
	"text" TEXT NOT NULL COMMENT E'',
	"preview" TEXT NULL DEFAULT NULL COMMENT E'',
	"seo_url" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"name" CHARACTER VARYING NOT NULL COMMENT E'',
	"meta_title" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"meta_descr" TEXT NULL DEFAULT NULL COMMENT E'',
	"meta_keywords" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"h1_tag" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"tags" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	PRIMARY KEY ("id"),
	KEY ("category_id"),
	KEY ("lang_id"),
	KEY ("id")
);

-- Дамп данных таблицы public.article_category_lang: 3 rows
/*!40000 ALTER TABLE "article_category_lang" DISABLE KEYS */;
INSERT INTO "article_category_lang" ("id", "lang_id", "category_id", "text", "preview", "seo_url", "name", "meta_title", "meta_descr", "meta_keywords", "h1_tag", "tags") VALUES
	(1, 0, 1, E'Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem ', E'Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem ', E'lorem', E'Lorem ipsum', E'Lorem title', E'Lorem description', E'lorem, keyword', E'Lorem h1 tag', E'lorem tag'),
	(2, 2, 2, E'qwerty', E'qwerty', E'qwerty', E'qwerty', E'qwerty', E'qwerty', E'qwerty', E'qwerty', E'qwerty'),
	(3, 1, 2, E'йцукен', E'йцукен', E'йцукен', E'йцукен', E'йцукен', E'йцукен', E'йцукен', E'йцукен', E'йцукен');
/*!40000 ALTER TABLE "article_category_lang" ENABLE KEYS */;


-- Дамп структуры для таблица public.article_category_media
CREATE TABLE IF NOT EXISTS "article_category_media" (
	"id" INTEGER NOT NULL DEFAULT nextval('article_category_media_id_seq'::regclass) COMMENT E'',
	"category_id" INTEGER NOT NULL COMMENT E'',
	"media_id" INTEGER NOT NULL COMMENT E'',
	"media_alt" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"media_title" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"media_caption" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"type" CHARACTER VARYING(10) NOT NULL DEFAULT 'additional'::character varying COMMENT E'',
	PRIMARY KEY ("id"),
	KEY ("media_id"),
	KEY ("category_id"),
	KEY ("id")
);

-- Дамп данных таблицы public.article_category_media: 0 rows
/*!40000 ALTER TABLE "article_category_media" DISABLE KEYS */;
/*!40000 ALTER TABLE "article_category_media" ENABLE KEYS */;


-- Дамп структуры для таблица public.article_lang
CREATE TABLE IF NOT EXISTS "article_lang" (
	"id" INTEGER NOT NULL DEFAULT nextval('article_lang_id_seq'::regclass) COMMENT E'',
	"lang_id" INTEGER NOT NULL COMMENT E'',
	"article_id" INTEGER NOT NULL COMMENT E'',
	"text" TEXT NOT NULL COMMENT E'',
	"seo_url" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"name" CHARACTER VARYING NOT NULL COMMENT E'',
	"preview" TEXT NULL DEFAULT NULL COMMENT E'',
	"meta_title" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"meta_descr" TEXT NULL DEFAULT NULL COMMENT E'',
	"meta_keywords" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"h1_tag" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"tags" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	PRIMARY KEY ("id"),
	KEY ("article_id"),
	KEY ("lang_id"),
	KEY ("id")
);

-- Дамп данных таблицы public.article_lang: 2 rows
/*!40000 ALTER TABLE "article_lang" DISABLE KEYS */;
INSERT INTO "article_lang" ("id", "lang_id", "article_id", "text", "seo_url", "name", "preview", "meta_title", "meta_descr", "meta_keywords", "h1_tag", "tags") VALUES
	(1, 0, 5, E'Lorem Lorem Lorem', E'article1', E'artivle1', E'Lorem preview', E'Lorem title', E'Lorem description', E'lorem, keyword', E'lorem h1 tag', E'tag, lorem'),
	(2, 0, 12, E'Lorem Lorem Lorem', E'article3', E'artivle3\r\n', E'Lorem preview', E'Lorem title', E'Lorem description', E'lorem, keyword', E'lorem h1 tag', E'tag, lorem');
/*!40000 ALTER TABLE "article_lang" ENABLE KEYS */;


-- Дамп структуры для таблица public.article_media
CREATE TABLE IF NOT EXISTS "article_media" (
	"id" INTEGER NOT NULL DEFAULT nextval('article_media_id_seq'::regclass) COMMENT E'',
	"article_id" INTEGER NOT NULL COMMENT E'',
	"media_id" INTEGER NOT NULL COMMENT E'',
	"type" CHARACTER VARYING(10) NOT NULL DEFAULT 'additional'::character varying COMMENT E'',
	"media_alt" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"media_title" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	"media_caption" CHARACTER VARYING NULL DEFAULT NULL COMMENT E'',
	PRIMARY KEY ("id"),
	KEY ("media_id"),
	KEY ("article_id"),
	KEY ("id")
);

-- Дамп данных таблицы public.article_media: 0 rows
/*!40000 ALTER TABLE "article_media" DISABLE KEYS */;
/*!40000 ALTER TABLE "article_media" ENABLE KEYS */;


-- Дамп структуры для таблица public.media
CREATE TABLE IF NOT EXISTS "media" (
	"id" INTEGER NOT NULL DEFAULT nextval('media_id_seq'::regclass) COMMENT E'',
	"hash" CHARACTER VARYING NOT NULL COMMENT E'',
	PRIMARY KEY ("id"),
	KEY ("id")
);

-- Дамп данных таблицы public.media: 0 rows
/*!40000 ALTER TABLE "media" DISABLE KEYS */;
/*!40000 ALTER TABLE "media" ENABLE KEYS */;


-- Дамп структуры для таблица public.option
CREATE TABLE IF NOT EXISTS "option" (
	"model" CHARACTER VARYING(200) NULL DEFAULT NULL COMMENT E'',
	"option_id" INTEGER NOT NULL DEFAULT nextval('option_option_id_seq'::regclass) COMMENT E'',
	"model_id" INTEGER NULL DEFAULT NULL COMMENT E'',
	"name" CHARACTER VARYING(200) NULL DEFAULT NULL COMMENT E'',
	"template" CHARACTER VARYING(200) NULL DEFAULT NULL COMMENT E'',
	"parent_id" INTEGER NULL DEFAULT NULL COMMENT E'',
	"translate" BIT(1) NULL DEFAULT NULL COMMENT E'',
	"created_at" TIMESTAMP WITHOUT TIME ZONE NULL DEFAULT now() COMMENT E'',
	KEY ("option_id"),
	KEY ("parent_id"),
	PRIMARY KEY ("option_id")
);

-- Дамп данных таблицы public.option: 0 rows
/*!40000 ALTER TABLE "option" DISABLE KEYS */;
/*!40000 ALTER TABLE "option" ENABLE KEYS */;


-- Дамп структуры для таблица public.option_lang
CREATE TABLE IF NOT EXISTS "option_lang" (
	"primary" INTEGER NOT NULL DEFAULT nextval('option_lang_primary_seq'::regclass) COMMENT E'',
	"id" INTEGER NULL DEFAULT NULL COMMENT E'',
	"lang_id" INTEGER NULL DEFAULT NULL COMMENT E'',
	"value" TEXT NULL DEFAULT NULL COMMENT E'',
	KEY ("id"),
	PRIMARY KEY ("primary")
);

-- Дамп данных таблицы public.option_lang: 0 rows
/*!40000 ALTER TABLE "option_lang" DISABLE KEYS */;
/*!40000 ALTER TABLE "option_lang" ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
