diff --git a/treeherder/model/sql/template_schema/project_jobs_1.sql.tmpl b/treeherder/model/sql/template_schema/project_jobs_1.sql.tmpl index dc2825054..543ec4ede 100644 --- a/treeherder/model/sql/template_schema/project_jobs_1.sql.tmpl +++ b/treeherder/model/sql/template_schema/project_jobs_1.sql.tmpl @@ -80,7 +80,7 @@ DROP TABLE IF EXISTS `job`; * build_platform_id - References treeherder_reference_1.build_platform.id * machine_platform_id - References treeherder_reference_1.machine_platform.id * machine_id - References treeherder_reference_1.machine.id - * option_collection_id - References treeherder_reference_1.option_collection.id + * option_collection_id - References treeherder_reference_1.option_collection.option_collection_id * job_type_id - References treeherder_reference_1.job_type.id * product_id - References treeherder_reference_1.product.id * who - Description of who submitted the job: gaia | scheduler name | username diff --git a/treeherder/model/sql/template_schema/treeherder_reference_1.sql.tmpl b/treeherder/model/sql/template_schema/treeherder_reference_1.sql.tmpl index 1811885ec..73f4d4be7 100644 --- a/treeherder/model/sql/template_schema/treeherder_reference_1.sql.tmpl +++ b/treeherder/model/sql/template_schema/treeherder_reference_1.sql.tmpl @@ -358,13 +358,17 @@ DROP TABLE IF EXISTS `option_collection`; * * Example Data: * + * option_collection_id - Used to group collections of objects * option_id - References option.id **************************/ CREATE TABLE `option_collection` ( - `id` int(10) unsigned NOT NULL, + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `option_collection_id` int(10) unsigned NOT NULL, `option_id` int(10) unsigned NOT NULL, - UNIQUE KEY `uni_option_collection` (`id`,`option_id`), - KEY `fk_option` (`option_id`), + PRIMARY KEY (`id`), + UNIQUE KEY `uni_option_collection` (`option_collection_id`,`option_id`), + KEY `idx_option` (`option_id`), + KEY `idx_option_collection_id` (`option_collection_id`), CONSTRAINT `fk_option` FOREIGN KEY (`option_id`) REFERENCES `option` (`id`) ) ENGINE={engine} DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */;