From a93a35de8d3b3c0e295d033a17d7e2e2e18fa7c6 Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Tue, 26 Jan 2021 16:50:34 +0000 Subject: [PATCH] Add 'stubbed' column to broadcast_message table This is a boolean column. It will be set to True for broadcasts created from training broadcast accounts. This will help us debug, for example by excluding all the stubbed broadcasts when we have some trouble with real broadcasts. --- app/models.py | 2 ++ .../versions/0340_stub_training_broadcasts.py | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 migrations/versions/0340_stub_training_broadcasts.py diff --git a/app/models.py b/app/models.py index 7dac89327..91e2f35b9 100644 --- a/app/models.py +++ b/app/models.py @@ -2269,6 +2269,8 @@ class BroadcastMessage(db.Model): reference = db.Column(db.String(255), nullable=True) + stubbed = db.Column(db.Boolean, nullable=True) + CheckConstraint("created_by_id is not null or api_key_id is not null") @property diff --git a/migrations/versions/0340_stub_training_broadcasts.py b/migrations/versions/0340_stub_training_broadcasts.py new file mode 100644 index 000000000..beb2ac8cc --- /dev/null +++ b/migrations/versions/0340_stub_training_broadcasts.py @@ -0,0 +1,25 @@ +""" + +Revision ID: 0340_stub_training_broadcasts +Revises: 0339_service_billing_details +Create Date: 2021-01-26 16:48:44.921065 + +""" +from alembic import op +import sqlalchemy as sa + + +revision = '0340_stub_training_broadcasts' +down_revision = '0339_service_billing_details' + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('broadcast_message', sa.Column('stubbed', sa.Boolean(), nullable=True)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('broadcast_message', 'stubbed') + # ### end Alembic commands ###