Simpify org types migration script and introduce foreign key

Don't transform org types on prod
This commit is contained in:
Pea Tyczynska
2019-07-24 16:37:23 +01:00
parent 5b256fa64e
commit 38bb2c1cf6
5 changed files with 82 additions and 96 deletions

View File

@@ -365,7 +365,12 @@ class Organisation(db.Model):
agreement_signed_on_behalf_of_email_address = db.Column(db.String(255), nullable=True)
agreement_signed_version = db.Column(db.Float, nullable=True)
crown = db.Column(db.Boolean, nullable=True)
organisation_type = db.Column(db.String(255), nullable=True)
organisation_type = db.Column(
db.String(255),
db.ForeignKey('organisation_types.name'),
unique=False,
nullable=True,
)
request_to_go_live_notes = db.Column(db.Text)
domains = db.relationship(
@@ -456,6 +461,8 @@ class Service(db.Model, Versioned):
prefix_sms = db.Column(db.Boolean, nullable=False, default=True)
organisation_type = db.Column(
db.String(255),
db.ForeignKey('organisation_types.name'),
unique=False,
nullable=True,
)
crown = db.Column(db.Boolean, index=False, nullable=True)

View File

@@ -266,6 +266,7 @@ class ServiceSchema(BaseSchema):
class DetailedServiceSchema(BaseSchema):
statistics = fields.Dict()
organisation_type = field_for(models.Service, 'organisation_type')
class Meta:
model = models.Service