Files
docupulse/migrations/versions/444d76da74ba_add_notifications_table.py
2025-06-02 16:11:56 +02:00

43 lines
1.4 KiB
Python

"""add_notifications_table
Revision ID: 444d76da74ba
Revises: c770e08966b4
Create Date: 2025-06-02 08:25:48.241102
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import inspect
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '444d76da74ba'
down_revision = 'c770e08966b4'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('template_variables')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
conn = op.get_bind()
inspector = inspect(conn)
tables = inspector.get_table_names()
if 'template_variables' not in tables:
op.create_table('template_variables',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('notification_type', sa.VARCHAR(length=50), autoincrement=False, nullable=False),
sa.Column('variable_name', sa.VARCHAR(length=50), autoincrement=False, nullable=False),
sa.Column('description', sa.VARCHAR(length=200), autoincrement=False, nullable=False),
sa.Column('example_value', sa.VARCHAR(length=200), autoincrement=False, nullable=True),
sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('template_variables_pkey'))
)
# ### end Alembic commands ###