Mercurial > hgweb > health
changeset 1549:6ca7c64e8dc1 stable
Fix bug #43347 Invalid assignment of institution in appointments
| author | Luis Falcon <falcon@gnu.org> |
|---|---|
| date | Thu, 02 Oct 2014 14:01:18 +0100 |
| parents | 58c03d412d35 |
| children | deb534c24e32 |
| files | tryton/health/health.py tryton/scripts/upgrade/2.6/fix_appointments_instituion.sql |
| diffstat | 2 files changed, 27 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tryton/health/health.py +++ b/tryton/health/health.py @@ -773,7 +773,7 @@ # Drop old foreign key from Appointment - if TableHandler.table_exist(cursor,'gnuhealth_hospital_appointment'): + if TableHandler.table_exist(cursor,'gnuhealth_appointment'): try: cursor.execute("ALTER TABLE gnuhealth_appointment DROP \ CONSTRAINT IF EXISTS \
new file mode 100644 --- /dev/null +++ b/tryton/scripts/upgrade/2.6/fix_appointments_instituion.sql @@ -0,0 +1,26 @@ +/* +# GNU HEALTH : The Free Health and Hospital Information System +# (c) 2008-2014 Luis Falcon <falcon@gnu.org> +# (c) 2008-2014 GNU Solidario <info@gnusolidario.org> + +# Program name : fix_appointments_instituion.sql + +# Script to fix the institution assignment on the appointment model + +# Versions affected : Any UPGRADE to 2.6 series previous to 2.6.4 +# New installations starting in 2.6 are not affected + +# INSTRUCTIONS : +# +# 1) Run the script via psql your_db_name < fix_appointments_instituion.sql +# 2) Update the health module : +# $ cdexe +# $ ./trytond --update=health --database=your_db_name +# +# Execute this script ONLY once ! + +*/ + +ALTER TABLE gnuhealth_appointment DROP CONSTRAINT IF EXISTS gnuhealth_appointment_institution_fkey; + +UPDATE GNUHEALTH_APPOINTMENT SET INSTITUTION = GNUHEALTH_INSTITUTION.ID FROM GNUHEALTH_INSTITUTION WHERE GNUHEALTH_APPOINTMENT.INSTITUTION = GNUHEALTH_INSTITUTION.NAME
