mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 18:31:13 -05:00
add new notification_status column to models.py
We now have a new column in the database, but it isn't being populated. The first step is to make sure we update this column, while still keeping the old enum based column up to date as well. A couple of changes have had to happen to support this - one irritating thing is that if we're ever querying columns individually, including `Notification.status`, then we'll need to give that column a label, since under the hood it translates to `Notification._status_enum`. Accessing status through the ORM (i.e., my_noti.status = 'sending' or similar) will work fine.
This commit is contained in:
@@ -92,7 +92,7 @@ def register_errors(blueprint):
|
||||
@blueprint.errorhandler(SQLAlchemyError)
|
||||
def db_error(e):
|
||||
current_app.logger.exception(e)
|
||||
if e.orig.pgerror and \
|
||||
if hasattr(e, 'orig') and hasattr(e.orig, 'pgerror') and e.orig.pgerror and \
|
||||
('duplicate key value violates unique constraint "services_name_key"' in e.orig.pgerror or
|
||||
'duplicate key value violates unique constraint "services_email_from_key"' in e.orig.pgerror):
|
||||
return jsonify(
|
||||
|
||||
Reference in New Issue
Block a user