From 3422f038eb5a74899fc0334c0da806ce018d468e Mon Sep 17 00:00:00 2001 From: Son Date: Mon, 24 Jan 2022 15:18:56 +0100 Subject: [PATCH] add Notification title --- app/models.py | 1 + .../versions/2022_012415_07b870d7cc86_.py | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 migrations/versions/2022_012415_07b870d7cc86_.py diff --git a/app/models.py b/app/models.py index 8b3ac509..641bc7f2 100644 --- a/app/models.py +++ b/app/models.py @@ -2558,6 +2558,7 @@ class Notification(Base, ModelMixin): __tablename__ = "notification" user_id = sa.Column(sa.ForeignKey(User.id, ondelete="cascade"), nullable=False) message = sa.Column(sa.Text, nullable=False) + title = sa.Column(sa.String(512)) # whether user has marked the notification as read read = sa.Column(sa.Boolean, nullable=False, default=False) diff --git a/migrations/versions/2022_012415_07b870d7cc86_.py b/migrations/versions/2022_012415_07b870d7cc86_.py new file mode 100644 index 00000000..d734190c --- /dev/null +++ b/migrations/versions/2022_012415_07b870d7cc86_.py @@ -0,0 +1,29 @@ +"""empty message + +Revision ID: 07b870d7cc86 +Revises: 698424c429e9 +Create Date: 2022-01-24 15:00:32.928606 + +""" +import sqlalchemy_utils +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '07b870d7cc86' +down_revision = '698424c429e9' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('notification', sa.Column('title', sa.String(length=512), nullable=True)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('notification', 'title') + # ### end Alembic commands ###