Ticket #5680: r7811-mysql-duplicated-index-and-foreign-constraints.py

File r7811-mysql-duplicated-index-and-foreign-constraints.py, 564 bytes (added by Peter Melvyn <peter.melvyn@…>, 16 years ago)

Generated SQL showing duplicated index and foreign key constraints on MySQL

Line 
1BEGIN;
2CREATE TABLE `polls_poll` (
3 `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
4 `question` varchar(200) NOT NULL,
5 `pub_date` datetime NOT NULL
6)
7;
8CREATE TABLE `polls_choice` (
9 `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
10 `poll_id` integer NOT NULL,
11 `choice` varchar(200) NOT NULL,
12 `votes` integer NOT NULL
13)
14;
15ALTER TABLE `polls_choice` ADD CONSTRAINT poll_id_refs_id_5d896c23 FOREIGN KEY (`poll_id`) REFERENCES `polls_poll` (`id`);
16CREATE INDEX `polls_choice_poll_id` ON `polls_choice` (`poll_id`);
17COMMIT;
Back to Top