fix(notification+vlog upload)
This commit is contained in:
38
backend/migrations/versions/0002_add_push_subscriptions.py
Normal file
38
backend/migrations/versions/0002_add_push_subscriptions.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""Add push_subscriptions table for Web Push notifications
|
||||
|
||||
Revision ID: 0002_push_subscriptions
|
||||
Revises: 89527c8da8e1
|
||||
Create Date: 2025-01-27
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0002_push_subscriptions'
|
||||
down_revision = '89527c8da8e1'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'push_subscriptions',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('endpoint', sa.String(), nullable=False),
|
||||
sa.Column('p256dh', sa.String(), nullable=False),
|
||||
sa.Column('auth', sa.String(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('endpoint')
|
||||
)
|
||||
op.create_index(op.f('ix_push_subscriptions_id'), 'push_subscriptions', ['id'], unique=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_index(op.f('ix_push_subscriptions_id'), table_name='push_subscriptions')
|
||||
op.drop_table('push_subscriptions')
|
||||
|
||||
Reference in New Issue
Block a user