Skip to content

Commit

Permalink
Add in data migration to create amagmation and make affiliation_invit…
Browse files Browse the repository at this point in the history
…ations larger (bcgov#2656)
  • Loading branch information
seeker25 authored Dec 5, 2023
1 parent b7dcf74 commit 5d8b21d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Add in amalgamation corp type and extend receipient fields to 8k
Revision ID: 144d6e8bd4df
Revises: 9e8d6b3de6d5
Create Date: 2023-12-05 11:42:32.349688
"""
from alembic import op


# revision identifiers, used by Alembic.
revision = '144d6e8bd4df'
down_revision = '9e8d6b3de6d5'
branch_labels = None
depends_on = None


def upgrade():
op.execute(f"insert into corp_types (code, description, \"default\") values ('ATMP', 'Amalgamation', 'f') on conflict (code) do nothing;")
op.execute('alter table affiliation_invitations alter column recipient_email type varchar(8000);')

def downgrade():
op.execute('delete from corp_types where code=\'ATMP\';')
op.execute('alter table affiliation_invitations alter column recipient_email type varchar(100);')
2 changes: 1 addition & 1 deletion auth-api/src/auth_api/models/affiliation_invitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AffiliationInvitation(BaseModel): # pylint: disable=too-many-instance-att
affiliation_id = Column(ForeignKey('affiliations.id'), nullable=True, index=True)
sender_id = Column(ForeignKey('users.id'), nullable=False)
approver_id = Column(ForeignKey('users.id'), nullable=True)
recipient_email = Column(String(100), nullable=True)
recipient_email = Column(String(8000), nullable=True)
sent_date = Column(DateTime, nullable=False)
accepted_date = Column(DateTime, nullable=True)
token = Column(String(100), nullable=True) # stores the one time affiliation invitation token
Expand Down

0 comments on commit 5d8b21d

Please sign in to comment.