2017-05-15 12:59:44 +01:00
|
|
|
"""empty message
|
|
|
|
|
|
2017-05-25 13:46:03 +01:00
|
|
|
Revision ID: 0087_scheduled_notifications
|
|
|
|
|
Revises: 0086_add_norm_to_notification
|
2017-05-15 12:59:44 +01:00
|
|
|
Create Date: 2017-05-15 12:50:20.041950
|
|
|
|
|
|
|
|
|
|
"""
|
2024-04-01 15:12:33 -07:00
|
|
|
|
2017-05-15 12:59:44 +01:00
|
|
|
import sqlalchemy as sa
|
2023-12-08 21:43:52 -05:00
|
|
|
from alembic import op
|
2017-05-15 12:59:44 +01:00
|
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
|
|
2023-08-29 14:54:30 -07:00
|
|
|
revision = "0087_scheduled_notifications"
|
|
|
|
|
down_revision = "0086_add_norm_to_notification"
|
2017-05-15 12:59:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
2023-08-29 14:54:30 -07:00
|
|
|
op.create_table(
|
|
|
|
|
"scheduled_notifications",
|
|
|
|
|
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
|
|
|
|
|
sa.Column("notification_id", postgresql.UUID(as_uuid=True), nullable=False),
|
|
|
|
|
sa.Column("scheduled_for", sa.DateTime(), nullable=False),
|
|
|
|
|
sa.Column("pending", sa.Boolean, nullable=False, default=True),
|
|
|
|
|
sa.ForeignKeyConstraint(
|
|
|
|
|
["notification_id"],
|
|
|
|
|
["notifications.id"],
|
|
|
|
|
),
|
|
|
|
|
sa.PrimaryKeyConstraint("id"),
|
|
|
|
|
)
|
|
|
|
|
op.create_index(
|
|
|
|
|
op.f("ix_scheduled_notifications_notification_id"),
|
|
|
|
|
"scheduled_notifications",
|
|
|
|
|
["notification_id"],
|
|
|
|
|
unique=False,
|
|
|
|
|
)
|
2017-05-15 12:59:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
2023-08-29 14:54:30 -07:00
|
|
|
op.drop_index(
|
|
|
|
|
op.f("ix_scheduled_notifications_notification_id"),
|
|
|
|
|
table_name="scheduled_notifications",
|
|
|
|
|
)
|
|
|
|
|
op.drop_table("scheduled_notifications")
|