itf/migrations/sqldiff220812.sql

52 lines
1.9 KiB
MySQL
Raw Normal View History

-- Training
CREATE TABLE `itfprofiles_theatregroup_trainings` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`theatregroup_id` integer NOT NULL,
`training_id` integer NOT NULL,
UNIQUE (`theatregroup_id`, `training_id`)
)
;
ALTER TABLE `itfprofiles_theatregroup_trainings` ADD CONSTRAINT `training_id_refs_id_b03d630f` FOREIGN KEY (`training_id`) REFERENCES `itfprofiles_training` (`id`);
-- Resource
CREATE TABLE `itfprofiles_resource` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`title` varchar(255) NOT NULL,
`desc` longtext,
`fil` varchar(100),
`url` varchar(200),
`thumbnail` varchar(100)
)
;
CREATE TABLE `itfprofiles_theatregroup_resources` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`theatregroup_id` integer NOT NULL,
`resource_id` integer NOT NULL,
UNIQUE (`theatregroup_id`, `resource_id`)
)
;
ALTER TABLE `itfprofiles_theatregroup_resources` ADD CONSTRAINT `theatregroup_id_refs_id_e38b9fdb` FOREIGN KEY (`theatregroup_id`) REFERENCES `itfprofiles_theatregroup` (`id`);
ALTER TABLE `itfprofiles_theatregroup_resources` ADD CONSTRAINT `resource_id_refs_id_9b463807` FOREIGN KEY (`resource_id`) REFERENCES `itfprofiles_resource` (`id`);
-- Scriptbank. script added FK to Theatre group
ALTER TABLE `scriptbank_script` ADD COLUMN `theatre_group_id` integer NOT NULL;
ALTER TABLE `scriptbank_script` ADD CONSTRAINT `theatre_group_id_refs_id_ce3bf3b1` FOREIGN KEY (`theatre_group_id`) REFERENCES `itfprofiles_theatregroup` (`id`);
-- misc
CREATE INDEX `scriptbank_script_5b9aa168` ON `scriptbank_script` (`theatre_group_id`);
CREATE INDEX `itfprofiles_groupgroupoccupation_79ab4fb2` ON `itfprofiles_groupgroupoccupation` (`theatregroup_id`);
CREATE INDEX `itfprofiles_groupgroupoccupation_481bb443` ON `itfprofiles_groupgroupoccupation` (`groupoccupation_id`);
CREATE INDEX `itfprofiles_language_65da3d2c` ON `itfprofiles_language` (`code`);