# GNUmed database system bootstrapping config file
#-------------------------------------------------
# license: GPL v2 or later
# author: Karsten Hilbert@gmx.net

#----------------------------------
[installation]
interactive = yes

keep temp files = no

description = $description$
This will update an existing GNUmed version 9
database to the version 10 schema. It does not do
any harm to the data contained within.

The existing database is cloned first. The copy is
then modified. The original database remains unchanged.
$description$

bundles = $bundles$
v9-v10-static
v9-v10-dynamic
v10-fixups
$bundles$

#----------------------------------
[bundle v9-v10-static]
database alias = gnumed_v10
minimum postgresql version = 8.1
schema base directory = ../sql/v9-v10/static/
schema = $schema$
v10-gm-access_log-static.sql
v10-i18n-curr_lang-static.sql
v10-dem-identity-static.sql
v10-blobs-doc_med-static.sql
v10-clin-health_issue-static.sql
v10-clin-episode-static.sql
v10-clin-allergy_state-static.sql
v10-clin-waiting_list-static.sql
$schema$

#----------------------------------
[bundle v9-v10-dynamic]
database alias = gnumed_v10
minimum postgresql version = 8.1
schema base directory = ../sql/v9-v10/dynamic/
schema = $schema$
v10-gm-access_log-dynamic.sql
v10-gm-notifying_tables-dynamic.sql
v10-i18n-dynamic.sql
v10-cfg-cfg_str_array.sql
v10-gm-role_management-dynamic.sql
v10-dem-identity-dynamic.sql
v10-dem-v_basic_person.sql
v10-dem-v_staff.sql
v10-dem-v_person_jobs.sql
v10-dem-v_pat_addresses.sql
v10-clin-episode-dynamic.sql
v10-clin-allergy_state-dynamic.sql
v10-clin-allergy-dynamic.sql
v10-clin-health_issue-dynamic.sql
v10-clin-v_pat_narrative_journal.sql
v10-clin-v_pat_episodes.sql
v10-clin-v_pat_episodes_journal.sql
v10-clin-v_hx_family.sql
v10-clin-v_hx_family_journal.sql
v10-clin-v_pat_allergies.sql
v10-clin-v_pat_allergies_journal.sql
v10-clin-v_test_results.sql
v10-clin-v_test_results_journal.sql
v10-clin-v_pat_items.sql
v10-blobs-delete_document.sql
v10-blobs-v_doc_med.sql
v10-blobs-v_doc_desc.sql
v10-blobs-v_obj4doc_no_data.sql
v10-blobs-v_reviewed_doc_objects.sql
v10-blobs-v_latest_mugshot.sql
v10-blobs-v_doc_med_journal.sql
v10-clin-v_emr_journal.sql
v10-clin-v_lab_requests.sql
v10-clin-v_narrative4search.sql
v10-clin-v_coded_item_narrative.sql
v10-clin-v_problem_list.sql
v10-clin-v_pat_narrative.sql
v10-clin-v_pat_diag.sql
v10-clin-v_codes4diag.sql
v10-clin-v_reviewed_items.sql
v10-clin-waiting_list-dynamic.sql
v10-dem-v_provider_inbox.sql
v10-clin-encounter-dynamic.sql
v10-i18n-translations.sql
v10-clin-keyword_expansion-data.sql
$schema$

#----------------------------------
[bundle v10-fixups]
database alias = gnumed_v10
minimum postgresql version = 8.1
schema base directory = ../sql/v9-v10/fixups/
schema = $schema$
v10-blobs-delete_document-fixup.sql
v10-dem-identity-dob_trigger-fixup.sql
v10-clin-allergy-fixup.sql
v10-clin-v_pat_allergy_state_journal-fixup.sql
v10-clin-v_emr_journal-fixup.sql
v10-clin-trf_invalidate_review_on_result_change-fixup.sql
v10-gm-notifying_tables-fixup.sql
$schema$

#----------------------------------
[database gnumed_v10]
name = gnumed_v10
drop target database = 1
target version = v10
transfer users = 1
source database = gnumed_v9
source version = v9
audit disable = 1
schema base directory = ../sql/v9-v10/
schema = $schema$
$schema$

superuser schema = $superuser schema$
superuser/v10-adjust-gm_dbo.sql
$superuser schema$

upgrade plausibility checks = $upgrade plausibility checks$
identities::::select count(1) from dem.identity
select count(1) from dem.identity
names::::select count(1) from dem.names
select count(1) from dem.names
addresses::::select count(1) from dem.address
select count(1) from dem.address
episodes::::select count(1) from clin.episode
select count(1) from clin.episode
encounters::::select count(1) from clin.encounter
select count(1) from clin.v_pat_encounters
issues::::select count(1) from clin.health_issue
select count(1) from clin.health_issue
documents::::select count(1) from blobs.doc_med
select count(1) from blobs.doc_med
pages::::select count(1) from blobs.doc_obj
select count(1) from blobs.doc_obj
allergies::::select count(1) from clin.allergy
select count(1) from clin.allergy
clinical items::::select count(1) from clin.clin_root_item
select count(1) from clin.clin_root_item
communication channels::::select count(1) from dem.lnk_identity2comm
select count(1) from dem.lnk_identity2comm
test results::::select count(1) from clin.test_result
select count(1) from clin.test_result
unmatched test results::::select count(1) from clin.incoming_data_unmatched
select count(1) from clin.incoming_data_unmatched
unmatchable test results::::select count(1) from clin.incoming_data_unmatchable
select count(1) from clin.incoming_data_unmatchable
allergy states::::select count(1) from clin.allergy_state where fk_patient in (select distinct fk_patient from clin.encounter)
select count(1) from clin.allergy_state
waiting list entries::::select count(1) from clin.waiting_list
select count(1) -1 from clin.waiting_list
$upgrade plausibility checks$

script base directory = ../sql/v9-v10/python/
data import scripts = $data import scripts$
$data import scripts$

#----------------------------------
[cluster]
host name = 
port = 5432
maintenance database = template1
schema base directory = ../sql/v9-v10/
schema = $schema$
$schema$

#----------------------------------
# these really shouldn't be changed
#----------------------------------
[GnuMed defaults]

groups = $groups$
$groups$

#----------------------------------
