mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-10 07:12:20 -05:00
72 lines
1.9 KiB
Python
72 lines
1.9 KiB
Python
"""empty message
|
|
|
|
Revision ID: 0043_notification_indexes
|
|
Revises: 0042_notification_history
|
|
Create Date: 2016-08-01 10:37:41.198070
|
|
|
|
"""
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "0043_notification_indexes"
|
|
down_revision = "0042_notification_history"
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
|
|
def upgrade():
|
|
op.create_index(
|
|
op.f("ix_notifications_created_at"), "notifications", ["created_at"]
|
|
)
|
|
op.create_index(
|
|
op.f("ix_notification_history_created_at"),
|
|
"notification_history",
|
|
["created_at"],
|
|
)
|
|
|
|
op.create_index(op.f("ix_notifications_status"), "notifications", ["status"])
|
|
op.create_index(
|
|
op.f("ix_notification_history_status"), "notification_history", ["status"]
|
|
)
|
|
|
|
op.create_index(
|
|
op.f("ix_notifications_notification_type"),
|
|
"notifications",
|
|
["notification_type"],
|
|
)
|
|
op.create_index(
|
|
op.f("ix_notification_history_notification_type"),
|
|
"notification_history",
|
|
["notification_type"],
|
|
)
|
|
|
|
op.create_index(
|
|
"ix_notification_history_week_created",
|
|
"notification_history",
|
|
[sa.text("date_trunc('week', created_at)")],
|
|
)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_index(op.f("ix_notifications_created_at"), table_name="notifications")
|
|
op.drop_index(
|
|
op.f("ix_notification_history_created_at"), table_name="notification_history"
|
|
)
|
|
|
|
op.drop_index(op.f("ix_notifications_status"), table_name="notifications")
|
|
op.drop_index(
|
|
op.f("ix_notification_history_status"), table_name="notification_history"
|
|
)
|
|
|
|
op.drop_index(
|
|
op.f("ix_notifications_notification_type"), table_name="notifications"
|
|
)
|
|
op.drop_index(
|
|
op.f("ix_notification_history_notification_type"),
|
|
table_name="notification_history",
|
|
)
|
|
|
|
op.drop_index(
|
|
op.f("ix_notification_history_week_created"), table_name="notification_history"
|
|
)
|