Skip to content
Snippets Groups Projects
Commit 03c2fcfa authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

Add sub organization model

parent f36b693c
No related branches found
No related tags found
No related merge requests found
......@@ -90,3 +90,12 @@ class ParentOrganization(base_schema):
nren = relationship(NREN, lazy='joined')
year = sa.Column(sa.Integer, primary_key=True)
organization = sa.Column(sa.String(128), nullable=False)
class SubOrganization(base_schema):
__tablename__ = 'sub_organization'
nren_id = sa.Column(sa.Integer, sa.schema.ForeignKey(NREN.id), primary_key=True)
nren = relationship(NREN, lazy='joined')
year = sa.Column(sa.Integer, primary_key=True)
organization = sa.Column(sa.String(128), primary_key=True)
role = sa.Column(sa.String(128), nullable=False)
"""Add sub org model
Revision ID: faf15719e2c6
Revises: 23ff6e527796
Create Date: 2023-04-24 12:44:41.741545
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'faf15719e2c6'
down_revision = '23ff6e527796'
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
'sub_organization',
sa.Column('nren_id', sa.Integer(), nullable=False),
sa.Column('year', sa.Integer(), nullable=False),
sa.Column('organization', sa.String(length=128), nullable=False),
sa.Column('role', sa.String(length=128), nullable=False),
sa.ForeignKeyConstraint(['nren_id'], ['nren.id'], name=op.f('fk_sub_organization_nren_id_nren')),
sa.PrimaryKeyConstraint('nren_id', 'year', 'organization', name=op.f('pk_sub_organization'))
)
def downgrade():
op.drop_table('sub_organization')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment