It's not really bug but more of a lack of implementaton which kills the feature. The problem is that Schema Export doesn't count on foreign key dependencies. In my case I have DB which contains information about different tests. So I have tables with test information, table of questions and finally table which contains answers. Here is script created by MyDeveloper Studio:
Code: Select all
--
-- Table structure for table test_answers
--
create table `test_answers` (
`question_id` bigint(20) not null auto_increment,
`position` int(11) not null,
`text` varchar(1024) not null,
`is_right_answer` tinyint(1) not null default '0' comment 'Determines right answer(s) on the question',
`has_picture` tinyint(1) not null default '0',
primary key (`question_id`,`position`),
constraint `question_id` foreign key (`question_id`) references `test_questions` (`id`)
) engine=innodb auto_increment=2 default charset=utf8;
--
-- Table structure for table test_questions
--
create table `test_questions` (
`id` bigint(20) not null auto_increment,
`test_id` bigint(20) not null,
`position` int(11) not null,
`name` varchar(1024) not null,
`has_picture` tinyint(1) not null,
primary key (`id`),
unique key `test_id_position` (`test_id`,`position`),
constraint `test_id` foreign key (`test_id`) references `tests` (`id`)
) engine=innodb auto_increment=3 default charset=utf8;
--
-- Table structure for table tests
--
create table `tests` (
`id` bigint(20) not null auto_increment,
`owner_id` bigint(20) not null,
`name` varchar(256) not null,
`subject_id` int(11) not null,
`sub_subject_id` int(11) not null,
`access_id` tinyint(4) not null,
primary key (`id`),
key `access_id` (`access_id`),
key `subject_id` (`subject_id`),
key `owner_id` (`owner_id`),
constraint `access_id` foreign key (`access_id`) references `access_types` (`id`),
constraint `owner_id` foreign key (`owner_id`) references `users` (`id`),
constraint `subject_id` foreign key (`subject_id`) references `subject_types` (`id`)
) engine=innodb auto_increment=2 default charset=utf8;
So MyDeveloper Studio should export schema script in order these objects were created.
Thank you.