sections!

This commit is contained in:
2025-06-08 17:07:31 +02:00
parent b616369b6f
commit 3a4e7bf41b
23 changed files with 322 additions and 48 deletions

View File

@@ -0,0 +1,34 @@
"""Add Section model and relationship to Plant
Revision ID: f746ca4a01f7
Revises: f83d55cc5aa7
Create Date: 2025-06-08 17:00:55.885897
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f746ca4a01f7'
down_revision = 'f83d55cc5aa7'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('plant', schema=None) as batch_op:
batch_op.add_column(sa.Column('section_id', sa.Integer(), nullable=True))
batch_op.create_foreign_key(None, 'section', ['section_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('plant', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.drop_column('section_id')
# ### end Alembic commands ###