BEGIN CREATE TABLE articles_articlecate gory id integer AUTO_INCREMENT

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
BEGIN;
CREATE TABLE `articles_articlecategory` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`title` varchar(255) NOT NULL,
`slug` varchar(50) NOT NULL UNIQUE,
`image` varchar(100),
`image_alt` varchar(255),
`image_title` varchar(255),
`add_watermark` bool NOT NULL,
`description` longtext,
`author_id` integer NOT NULL,
`published` bool NOT NULL,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
`visits_num` integer UNSIGNED NOT NULL
)
;
ALTER TABLE `articles_articlecategory` ADD CONSTRAINT `author_id_refs_id_d80d7386` FOREIGN KEY (`author_id`) REFERENCES `auth_user` (`id`);
CREATE TABLE `articles_article` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`title` varchar(255) NOT NULL,
`slug` varchar(50) NOT NULL UNIQUE,
`old_id` integer UNIQUE,
`image` varchar(100),
`image_alt` varchar(255),
`image_title` varchar(255),
`add_watermark` bool NOT NULL,
`description` longtext,
`body` longtext NOT NULL,
`author_id` integer NOT NULL,
`category_id` integer NOT NULL,
`verified` bool NOT NULL,
`published` bool NOT NULL,
`pub_date` datetime NOT NULL,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
`visits_num` integer UNSIGNED NOT NULL,
`comments_num` integer UNSIGNED NOT NULL
)
;
ALTER TABLE `articles_article` ADD CONSTRAINT `category_id_refs_id_02a85c3e` FOREIGN KEY (`category_id`) REFERENCES `articles_articlecategory` (`id`);
ALTER TABLE `articles_article` ADD CONSTRAINT `author_id_refs_id_7965054d` FOREIGN KEY (`author_id`) REFERENCES `auth_user` (`id`);
COMMIT;