new features
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
"""add notifications table
|
||||
|
||||
Revision ID: 6a41fa07bd94
|
||||
Revises: 0001
|
||||
Create Date: 2026-02-20 19:07:40.634385
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '6a41fa07bd94'
|
||||
down_revision: Union[str, None] = '0001'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('notifications',
|
||||
sa.Column('user_id', sa.UUID(), nullable=False),
|
||||
sa.Column('job_id', sa.UUID(), nullable=True),
|
||||
sa.Column('project_id', sa.UUID(), nullable=True),
|
||||
sa.Column('notification_type', sa.String(length=32), nullable=False),
|
||||
sa.Column('title', sa.String(length=255), nullable=False),
|
||||
sa.Column('message', sa.Text(), nullable=True),
|
||||
sa.Column('payload', sa.JSON(), nullable=True),
|
||||
sa.Column('is_read', sa.Boolean(), nullable=False),
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('is_active', sa.Boolean(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], ondelete='SET NULL'),
|
||||
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ondelete='SET NULL'),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_notifications_user_id'), 'notifications', ['user_id'], unique=False)
|
||||
op.drop_constraint(op.f('uq_users_username'), 'users', type_='unique')
|
||||
op.drop_index(op.f('ix_users_username'), table_name='users')
|
||||
op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_users_username'), table_name='users')
|
||||
op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=False)
|
||||
op.create_unique_constraint(op.f('uq_users_username'), 'users', ['username'], postgresql_nulls_not_distinct=False)
|
||||
op.drop_index(op.f('ix_notifications_user_id'), table_name='notifications')
|
||||
op.drop_table('notifications')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user