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

Add parent organization model

parent a5cfc83b
No related branches found
No related tags found
No related merge requests found
......@@ -82,3 +82,11 @@ class NrenStaff(base_schema):
subcontracted_fte = sa.Column(sa.Numeric(asdecimal=False), nullable=False)
technical_fte = sa.Column(sa.Numeric(asdecimal=False), nullable=False)
non_technical_fte = sa.Column(sa.Numeric(asdecimal=False), nullable=False)
class ParentOrganization(base_schema):
__tablename__ = 'parent_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), nullable=False)
"""Add parent organization model
Revision ID: 23ff6e527796
Revises: c75984d47182
Create Date: 2023-04-21 12:21:40.201830
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '23ff6e527796'
down_revision = 'c75984d47182'
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
'parent_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.ForeignKeyConstraint(['nren_id'], ['nren.id'], name=op.f('fk_parent_organization_nren_id_nren')),
sa.PrimaryKeyConstraint('nren_id', 'year', name=op.f('pk_parent_organization'))
)
def downgrade():
op.drop_table('parent_organization')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment