Skip to content

Commit 440935f

Browse files
authored
Add a table to store annual_limits data (#2339)
* Add a table to store annual_limits data * forgot to commit formatting changes
1 parent 868d8f4 commit 440935f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""
2+
Revision ID: 0464_add_annual_limits_data
3+
Revises: 0463_add_annual_limit_column
4+
Create Date: 2024-10-31 13:32:00
5+
"""
6+
import sqlalchemy as sa
7+
from alembic import op
8+
from sqlalchemy.dialects.postgresql import UUID
9+
10+
revision = "0464_add_annual_limits_data"
11+
down_revision = "0463_add_annual_limit_column"
12+
13+
14+
def upgrade():
15+
op.create_table(
16+
"annual_limits_data",
17+
sa.Column("service_id", UUID, nullable=False),
18+
sa.Column("time_period", sa.VARCHAR, nullable=False),
19+
sa.Column("annual_email_limit", sa.BigInteger, nullable=False),
20+
sa.Column("annual_sms_limit", sa.BigInteger, nullable=False),
21+
sa.Column("notification_type", sa.Enum(name="notification_type", native_enum=False, create_type=False), nullable=False),
22+
sa.Column("notification_count", sa.BigInteger, nullable=False),
23+
sa.ForeignKeyConstraint(["service_id"], ["services.id"], name="fk_service_id"),
24+
)
25+
op.create_index("ix_service_id_notification_type", "annual_limits_data", ["service_id", "notification_type"])
26+
27+
28+
def downgrade():
29+
op.drop_table("annual_limits_data")

0 commit comments

Comments
 (0)