mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-24 00:06:16 -04:00
Update model and migration script
This commit is contained in:
@@ -130,11 +130,11 @@ class BrandingTypes(db.Model):
|
|||||||
name = db.Column(db.String(255), primary_key=True)
|
name = db.Column(db.String(255), primary_key=True)
|
||||||
|
|
||||||
|
|
||||||
class Organisation(db.Model, Versioned):
|
class Organisation(db.Model):
|
||||||
__tablename__ = 'organisation'
|
__tablename__ = 'organisation'
|
||||||
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||||
colour = db.Column(db.String(7), nullable=True)
|
colour = db.Column(db.String(7), nullable=True)
|
||||||
logo = db.Column(db.String(255), nullable=True)
|
logo = db.Column(db.String(255), nullable=False)
|
||||||
name = db.Column(db.String(255), nullable=True)
|
name = db.Column(db.String(255), nullable=True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -142,7 +142,7 @@ class Organisation(db.Model, Versioned):
|
|||||||
"""
|
"""
|
||||||
Assumption: data has been validated appropriately.
|
Assumption: data has been validated appropriately.
|
||||||
|
|
||||||
Returns a Organisation object based on the provided data.
|
Returns a Organisation object based on the provided data.
|
||||||
"""
|
"""
|
||||||
# validate json with marshmallow
|
# validate json with marshmallow
|
||||||
fields = data.copy()
|
fields = data.copy()
|
||||||
|
|||||||
27
migrations/versions/0105_change_logo_not_nullable.py
Normal file
27
migrations/versions/0105_change_logo_not_nullable.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 0105_change_logo_not_nullable
|
||||||
|
Revises: 0104_more_letter_orgs
|
||||||
|
Create Date: 2017-07-06 10:14:35.188404
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '0105_change_logo_not_nullable'
|
||||||
|
down_revision = '0104_more_letter_orgs'
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.alter_column('organisation', 'logo',
|
||||||
|
existing_type=sa.VARCHAR(length=255),
|
||||||
|
nullable=False)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.alter_column('organisation', 'logo',
|
||||||
|
existing_type=sa.VARCHAR(length=255),
|
||||||
|
nullable=True)
|
||||||
Reference in New Issue
Block a user