Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in data migration to create amagmation and make affiliation_invit… #2656

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading