mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Add new columns to services and services_history.
go_live_user_id: is the user that requested the service to go live go_live_at: is the DateTime the service went live. There will be a data migration from the beta partners spreadsheet to back fill the data.
This commit is contained in:
@@ -402,8 +402,8 @@ class Service(db.Model, Versioned):
|
||||
restricted = db.Column(db.Boolean, index=False, unique=False, nullable=False)
|
||||
research_mode = db.Column(db.Boolean, index=False, unique=False, nullable=False, default=False)
|
||||
email_from = db.Column(db.Text, index=False, unique=True, nullable=False)
|
||||
created_by = db.relationship('User')
|
||||
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), index=True, nullable=False)
|
||||
created_by = db.relationship('User', foreign_keys=[created_by_id])
|
||||
prefix_sms = db.Column(db.Boolean, nullable=False, default=True)
|
||||
organisation_type = db.Column(
|
||||
db.String(255),
|
||||
@@ -417,6 +417,9 @@ class Service(db.Model, Versioned):
|
||||
volume_letter = db.Column(db.Integer(), nullable=True, unique=False)
|
||||
consent_to_research = db.Column(db.Boolean, nullable=True)
|
||||
count_as_live = db.Column(db.Boolean, nullable=False, default=True)
|
||||
go_live_user_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), nullable=True)
|
||||
go_live_user = db.relationship('User', foreign_keys=[go_live_user_id])
|
||||
go_live_at = db.Column(db.DateTime, nullable=True)
|
||||
|
||||
organisation = db.relationship(
|
||||
'Organisation',
|
||||
@@ -435,6 +438,8 @@ class Service(db.Model, Versioned):
|
||||
uselist=False,
|
||||
backref=db.backref('services', lazy='dynamic'))
|
||||
|
||||
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, data):
|
||||
"""
|
||||
|
||||
29
migrations/versions/0287_add_go_live_user.py
Normal file
29
migrations/versions/0287_add_go_live_user.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0287_add_go_live_user
|
||||
Revises: 0286_add_unique_email_name
|
||||
Create Date: 2019-04-15 16:50:22.275673
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '0287_add_go_live_user'
|
||||
down_revision = '0286_add_unique_email_name'
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('services', sa.Column('go_live_at', sa.DateTime(), nullable=True))
|
||||
op.add_column('services', sa.Column('go_live_user_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.create_foreign_key('fk_services_go_live_user', 'services', 'users', ['go_live_user_id'], ['id'])
|
||||
op.add_column('services_history', sa.Column('go_live_at', sa.DateTime(), nullable=True))
|
||||
op.add_column('services_history', sa.Column('go_live_user_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('services_history', 'go_live_user_id')
|
||||
op.drop_column('services_history', 'go_live_at')
|
||||
op.drop_constraint('fk_services_go_live_user', 'services', type_='foreignkey')
|
||||
op.drop_column('services', 'go_live_user_id')
|
||||
op.drop_column('services', 'go_live_at')
|
||||
Reference in New Issue
Block a user