Skip to content

Commit

Permalink
[FIX] connector_carepoint: Fix prescription migration
Browse files Browse the repository at this point in the history
* Add try/catch & rollback to db alterations in case server re-upgrades
  • Loading branch information
lasley committed Oct 17, 2016
1 parent 4d5fd73 commit 30bfe04
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions connector_carepoint/migrations/9.0.1.3.0/pre-migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@
# Copyright 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import logging

_logger = logging.getLogger(__name__)


def migrate(cr, version):
cr.execute('ALTER TABLE carepoint_medical_prescription_order_line '
'RENAME TO carepoint_rx_ord_ln')
try:
cr.execute('ALTER TABLE carepoint_medical_prescription_order_line '
'RENAME TO carepoint_rx_ord_ln')
except Exception:
cr.rollback()
_logger.exception('Cannot perform migration')

cr.execute('ALTER TABLE carepoint_carepoint_organization '
'RENAME TO carepoint_org_bind')
try:
cr.execute('ALTER TABLE carepoint_carepoint_organization '
'RENAME TO carepoint_org_bind')
except Exception:
cr.rollback()
_logger.exception('Cannot perform migration')

0 comments on commit 30bfe04

Please sign in to comment.