2023-11-30 20:57:51 +13:00
|
|
|
"""notifications
|
|
|
|
|
2023-11-30 23:21:37 +13:00
|
|
|
Revision ID: cae2e31293e8
|
2023-11-30 20:57:51 +13:00
|
|
|
Revises: ee45b9ea4a0c
|
2023-11-30 23:21:37 +13:00
|
|
|
Create Date: 2023-11-30 22:49:24.942158
|
2023-11-30 20:57:51 +13:00
|
|
|
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
|
|
import sqlalchemy as sa
|
|
|
|
|
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
2023-11-30 23:21:37 +13:00
|
|
|
revision = 'cae2e31293e8'
|
2023-11-30 20:57:51 +13:00
|
|
|
down_revision = 'ee45b9ea4a0c'
|
|
|
|
branch_labels = None
|
|
|
|
depends_on = None
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
|
|
op.create_table('notification',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('title', sa.String(length=50), nullable=True),
|
|
|
|
sa.Column('url', sa.String(length=512), nullable=True),
|
|
|
|
sa.Column('read', sa.Boolean(), nullable=True),
|
|
|
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
|
|
|
sa.Column('author_id', sa.Integer(), nullable=True),
|
|
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
|
|
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
|
|
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
|
|
|
with op.batch_alter_table('post', schema=None) as batch_op:
|
|
|
|
batch_op.add_column(sa.Column('notify_author', sa.Boolean(), nullable=True))
|
|
|
|
|
|
|
|
with op.batch_alter_table('post_reply', schema=None) as batch_op:
|
|
|
|
batch_op.add_column(sa.Column('notify_author', sa.Boolean(), nullable=True))
|
|
|
|
|
2023-11-30 23:21:37 +13:00
|
|
|
with op.batch_alter_table('user', schema=None) as batch_op:
|
|
|
|
batch_op.add_column(sa.Column('unread_notifications', sa.Integer(), nullable=True))
|
|
|
|
|
2023-11-30 20:57:51 +13:00
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
2023-11-30 23:21:37 +13:00
|
|
|
with op.batch_alter_table('user', schema=None) as batch_op:
|
|
|
|
batch_op.drop_column('unread_notifications')
|
|
|
|
|
2023-11-30 20:57:51 +13:00
|
|
|
with op.batch_alter_table('post_reply', schema=None) as batch_op:
|
|
|
|
batch_op.drop_column('notify_author')
|
|
|
|
|
|
|
|
with op.batch_alter_table('post', schema=None) as batch_op:
|
|
|
|
batch_op.drop_column('notify_author')
|
|
|
|
|
|
|
|
op.drop_table('notification')
|
|
|
|
# ### end Alembic commands ###
|