This commit is contained in:
Kenneth Kehl
2023-08-29 14:54:30 -07:00
parent 19dcd7a48b
commit 1ecb747c6d
588 changed files with 34091 additions and 23580 deletions
@@ -9,27 +9,43 @@ from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0204_service_data_retention'
down_revision = '0203_fix_old_incomplete_jobs'
revision = "0204_service_data_retention"
down_revision = "0203_fix_old_incomplete_jobs"
def upgrade():
op.create_table('service_data_retention',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('service_id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('notification_type', postgresql.ENUM(name='notification_type', create_type=False),
nullable=False),
sa.Column('days_of_retention', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('service_id', 'notification_type', name='uix_service_data_retention')
)
op.create_index(op.f('ix_service_data_retention_service_id'), 'service_data_retention', ['service_id'],
unique=False)
op.create_table(
"service_data_retention",
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
sa.Column("service_id", postgresql.UUID(as_uuid=True), nullable=False),
sa.Column(
"notification_type",
postgresql.ENUM(name="notification_type", create_type=False),
nullable=False,
),
sa.Column("days_of_retention", sa.Integer(), nullable=False),
sa.Column("created_at", sa.DateTime(), nullable=False),
sa.Column("updated_at", sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(
["service_id"],
["services.id"],
),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint(
"service_id", "notification_type", name="uix_service_data_retention"
),
)
op.create_index(
op.f("ix_service_data_retention_service_id"),
"service_data_retention",
["service_id"],
unique=False,
)
def downgrade():
op.drop_index(op.f('ix_service_data_retention_service_id'), table_name='service_data_retention')
op.drop_table('service_data_retention')
op.drop_index(
op.f("ix_service_data_retention_service_id"),
table_name="service_data_retention",
)
op.drop_table("service_data_retention")