diff --git a/src/main/resources/brapi/properties/application.properties b/src/main/resources/brapi/properties/application.properties index 48d433aa4..32fc7437f 100644 --- a/src/main/resources/brapi/properties/application.properties +++ b/src/main/resources/brapi/properties/application.properties @@ -21,12 +21,12 @@ server.servlet.context-path=/brapi/v2 spring.datasource.url=jdbc:postgresql://${BRAPI_DB_SERVER}/${BRAPI_DB} spring.datasource.username=${BRAPI_DB_USER} spring.datasource.password=${BRAPI_DB_PASSWORD} -spring.datasource.data=classpath:/sql/species.sql spring.datasource.driver-class-name=org.postgresql.Driver -spring.jpa.hibernate.ddl-auto=update +spring.jpa.hibernate.ddl-auto=create-only spring.jpa.show-sql=false +spring.jpa.properties.hibernate.hbm2ddl.import_files=sql/species.sql, sql/create_indexes.sql spring.mvc.dispatch-options-request=true diff --git a/src/main/resources/brapi/sql/create_indexes.sql b/src/main/resources/brapi/sql/create_indexes.sql new file mode 100644 index 000000000..6c0772bfd --- /dev/null +++ b/src/main/resources/brapi/sql/create_indexes.sql @@ -0,0 +1,28 @@ +-- See the NOTICE file distributed with this work for additional information +-- regarding copyright ownership. +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. + +-- Indexes to improve read performance of Germplasm operations. +CREATE INDEX CONCURRENTLY IF NOT EXISTS "pedigree_edge_this_node_id" ON pedigree_edge (this_node_id); +CREATE INDEX CONCURRENTLY IF NOT EXISTS "pedigree_edge_connected_node_id" ON pedigree_edge (connceted_node_id); +CREATE INDEX CONCURRENTLY IF NOT EXISTS "pedigree_edge_edge_type" ON pedigree_edge (edge_type); +CREATE INDEX CONCURRENTLY IF NOT EXISTS "program_external_references_program_entity_id" ON program_external_references (program_entity_id); +CREATE INDEX CONCURRENTLY IF NOT EXISTS "external_reference_composite" ON external_reference (external_reference_source, external_reference_id); +CREATE INDEX CONCURRENTLY IF NOT EXISTS "program_additional_info_composite" ON program_additional_info (additional_info_id, program_entity_id); +CREATE INDEX CONCURRENTLY IF NOT EXISTS "list_list_name" ON list (list_name); +CREATE INDEX CONCURRENTLY IF NOT EXISTS "pedigree_node_germplasm_id" ON pedigree_node (germplasm_id); +CREATE INDEX CONCURRENTLY IF NOT EXISTS "germplasm_additional_info_germplasm_entity_id" ON germplasm_additional_info (germplasm_entity_id); +CREATE INDEX CONCURRENTLY IF NOT EXISTS "germplasm_external_references_germplasm_entity_id" ON germplasm_external_references (germplasm_entity_id); +CREATE INDEX CONCURRENTLY IF NOT EXISTS "germplasm_synonym_germplasm_id" ON germplasm_synonym (germplasm_id); +CREATE INDEX CONCURRENTLY IF NOT EXISTS "germplasm_taxon_germplasm_id" ON germplasm_taxon (germplasm_id); \ No newline at end of file diff --git a/src/main/resources/brapi/sql/species.sql b/src/main/resources/brapi/sql/species.sql index 3134f6e6d..c57dd2ac9 100644 --- a/src/main/resources/brapi/sql/species.sql +++ b/src/main/resources/brapi/sql/species.sql @@ -1,19 +1,17 @@ -/* - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +-- See the NOTICE file distributed with this work for additional information +-- regarding copyright ownership. +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. INSERT INTO crop (id, crop_name) VALUES ('1', 'Blueberry') ON CONFLICT DO NOTHING; INSERT INTO crop (id, crop_name) VALUES ('2', 'Salmon') ON CONFLICT DO NOTHING;