diff --git a/app/models.py b/app/models.py index b9c7799bd..c2c92bb4f 100644 --- a/app/models.py +++ b/app/models.py @@ -1574,8 +1574,7 @@ class NotificationHistory(db.Model, HistoryModel): phone_prefix = db.Column(db.String, nullable=True) rate_multiplier = db.Column(db.Float(asdecimal=False), nullable=True) - created_by = db.relationship('User') - created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), nullable=True) + created_by_id = db.Column(UUID(as_uuid=True), nullable=True) postage = db.Column(db.String, nullable=True) CheckConstraint(""" diff --git a/migrations/versions/0278_remove_fk_to_users.py b/migrations/versions/0278_remove_fk_to_users.py new file mode 100644 index 000000000..355ff54d0 --- /dev/null +++ b/migrations/versions/0278_remove_fk_to_users.py @@ -0,0 +1,21 @@ +""" + +Revision ID: 0278_remove_fk_to_users +Revises: 0277_consent_to_research_null +Create Date: 2019-03-06 16:49:28.674498 + +""" +from alembic import op +import sqlalchemy as sa + + +revision = '0278_remove_fk_to_users' +down_revision = '0277_consent_to_research_null' + + +def upgrade(): + op.drop_constraint('notification_history_created_by_id_fkey', 'notification_history', type_='foreignkey') + + +def downgrade(): + op.create_foreign_key('notification_history_created_by_id_fkey', 'notification_history', 'users', ['created_by_id'], ['id'])