43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""add_notifications_table
|
|
|
|
Revision ID: de721927ff59
|
|
Revises: 98e23cab7057
|
|
Create Date: 2026-03-28 18:51:11.848830
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'de721927ff59'
|
|
down_revision: Union[str, Sequence[str], None] = '98e23cab7057'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('notifications',
|
|
sa.Column('id', sa.UUID(), nullable=False),
|
|
sa.Column('user_id', sa.UUID(), nullable=False),
|
|
sa.Column('type', sa.String(), nullable=False),
|
|
sa.Column('payload', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
|
|
sa.Column('read', sa.Boolean(), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(), nullable=False),
|
|
sa.Column('expires_at', sa.DateTime(), nullable=True),
|
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('notifications')
|
|
# ### end Alembic commands ###
|