mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-24 00:06:16 -04:00
Add columns for requested and allowed broadcast areas for a service
We want to restrict where broadcast services can broadcast to. Hence we are creating columns on service_broadcast_settings table to store the lists of allowed_broadcast_areas and requested_allowed_broadcast_areas.
This commit is contained in:
@@ -2557,6 +2557,9 @@ class ServiceBroadcastSettings(db.Model):
|
|||||||
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
|
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
|
||||||
updated_at = db.Column(db.DateTime, nullable=True, onupdate=datetime.datetime.utcnow)
|
updated_at = db.Column(db.DateTime, nullable=True, onupdate=datetime.datetime.utcnow)
|
||||||
|
|
||||||
|
allowed_broadcast_areas = db.Column(JSONB(none_as_null=True), nullable=False, default=list)
|
||||||
|
requested_allowed_broadcast_areas = db.Column(JSONB(none_as_null=True), nullable=True)
|
||||||
|
|
||||||
|
|
||||||
class BroadcastChannelTypes(db.Model):
|
class BroadcastChannelTypes(db.Model):
|
||||||
__tablename__ = 'broadcast_channel_types'
|
__tablename__ = 'broadcast_channel_types'
|
||||||
|
|||||||
31
migrations/versions/0351_allowed_broadcast_areas.py
Normal file
31
migrations/versions/0351_allowed_broadcast_areas.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
"""
|
||||||
|
|
||||||
|
Revision ID: 0351_allowed_broadcast_areas
|
||||||
|
Revises: 0350_update_rates
|
||||||
|
Create Date: 2021-04-09 12:51:17.158043
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
|
revision = '0351_allowed_broadcast_areas'
|
||||||
|
down_revision = '0350_update_rates'
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('service_broadcast_settings', sa.Column(
|
||||||
|
'allowed_broadcast_areas', postgresql.JSONB(none_as_null=True, astext_type=sa.Text()), nullable=True)
|
||||||
|
)
|
||||||
|
op.add_column('service_broadcast_settings', sa.Column(
|
||||||
|
'requested_allowed_broadcast_areas', postgresql.JSONB(none_as_null=True, astext_type=sa.Text()), nullable=True)
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column('service_broadcast_settings', 'requested_allowed_broadcast_areas')
|
||||||
|
op.drop_column('service_broadcast_settings', 'allowed_broadcast_areas')
|
||||||
|
# ### end Alembic commands ###
|
||||||
Reference in New Issue
Block a user