mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-10 23:32:27 -05:00
Update EmailBranding.name to be not null and unique.
Needed to update old migration scripts so that the email_branding name is not null when creating the test dbs. This should no affect the migrations elsewhere.
This commit is contained in:
@@ -22,7 +22,7 @@ def upgrade():
|
||||
'{}',
|
||||
'',
|
||||
'data_gov_uk_x2.png',
|
||||
''
|
||||
'data gov.uk'
|
||||
)""".format(DATA_GOV_UK_ID))
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ def upgrade():
|
||||
'{}',
|
||||
'',
|
||||
'tfl_dar_x2.png',
|
||||
''
|
||||
'tfl'
|
||||
)""".format(TFL_DAR_ID))
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ def upgrade():
|
||||
'{}',
|
||||
'',
|
||||
'een_x2.png',
|
||||
''
|
||||
'een'
|
||||
)""".format(ENTERPRISE_EUROPE_NETWORK_ID))
|
||||
|
||||
|
||||
|
||||
26
migrations/versions/0286_add_unique_email_name.py
Normal file
26
migrations/versions/0286_add_unique_email_name.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0286_add_unique_email_name
|
||||
Revises: 0285_default_org_branding
|
||||
Create Date: 2019-04-09 13:01:13.892249
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
revision = '0286_add_unique_email_name'
|
||||
down_revision = '0285_default_org_branding'
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('email_branding', 'name',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
op.create_unique_constraint('uq_email_branding_name', 'email_branding', ['name'])
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint('uq_email_branding_name', 'email_branding', type_='unique')
|
||||
op.alter_column('email_branding', 'name',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=True)
|
||||
Reference in New Issue
Block a user