1 from dmigrations
.mysql
import migrations
as m
3 migration
= m
.Migration(sql_up
=["""
4 CREATE TABLE `auth_permission` (
5 `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
6 `name` varchar(50) NOT NULL,
7 `content_type_id` integer NOT NULL,
8 `codename` varchar(100) NOT NULL,
9 UNIQUE (`content_type_id`, `codename`)
10 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
13 CREATE TABLE `auth_group` (
14 `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
15 `name` varchar(80) NOT NULL UNIQUE
16 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
19 CREATE TABLE `auth_user` (
20 `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
21 `username` varchar(30) NOT NULL UNIQUE,
22 `first_name` varchar(30) NOT NULL,
23 `last_name` varchar(30) NOT NULL,
24 `email` varchar(75) NOT NULL,
25 `password` varchar(128) NOT NULL,
26 `is_staff` bool NOT NULL,
27 `is_active` bool NOT NULL,
28 `is_superuser` bool NOT NULL,
29 `last_login` datetime NOT NULL,
30 `date_joined` datetime NOT NULL
31 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
34 CREATE TABLE `auth_message` (
35 `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
36 `user_id` integer NOT NULL,
37 `message` longtext NOT NULL
38 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
41 ALTER TABLE `auth_message` ADD CONSTRAINT user_id_refs_id_650f49a6 FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
43 CREATE TABLE `auth_group_permissions` (
44 `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
45 `group_id` integer NOT NULL,
46 `permission_id` integer NOT NULL,
47 UNIQUE (`group_id`, `permission_id`)
48 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
51 ALTER TABLE `auth_group_permissions` ADD CONSTRAINT group_id_refs_id_3cea63fe FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`);
53 ALTER TABLE `auth_group_permissions` ADD CONSTRAINT permission_id_refs_id_5886d21f FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`);
55 CREATE TABLE `auth_user_groups` (
56 `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
57 `user_id` integer NOT NULL,
58 `group_id` integer NOT NULL,
59 UNIQUE (`user_id`, `group_id`)
60 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
63 ALTER TABLE `auth_user_groups` ADD CONSTRAINT user_id_refs_id_7ceef80f FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
65 ALTER TABLE `auth_user_groups` ADD CONSTRAINT group_id_refs_id_f116770 FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`);
67 CREATE TABLE `auth_user_user_permissions` (
68 `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
69 `user_id` integer NOT NULL,
70 `permission_id` integer NOT NULL,
71 UNIQUE (`user_id`, `permission_id`)
72 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
75 ALTER TABLE `auth_user_user_permissions` ADD CONSTRAINT user_id_refs_id_dfbab7d FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
77 ALTER TABLE `auth_user_user_permissions` ADD CONSTRAINT permission_id_refs_id_67e79cb FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`);
79 -- The following references should be added but depend on non-existent tables:
81 -- ALTER TABLE `auth_permission` ADD CONSTRAINT content_type_id_refs_id_728de91f FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`);
83 DROP TABLE `auth_user_user_permissions`;
85 DROP TABLE `auth_user_groups`;
87 DROP TABLE `auth_group_permissions`;
89 DROP TABLE `auth_message`;
91 DROP TABLE `auth_user`;
93 DROP TABLE `auth_group`;
95 DROP TABLE `auth_permission`;