Changed initial_weight to be net weight, not gross weight
This commit is contained in:
@@ -23,12 +23,12 @@ def upgrade() -> None:
|
||||
"initial_weight",
|
||||
sa.Float(),
|
||||
nullable=True,
|
||||
comment="The initial total weight of the spool (gross weight).",
|
||||
comment="The initial weight of the filament on the spool (net weight).",
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"spool",
|
||||
sa.Column("empty_weight", sa.Float(), nullable=True, comment="The weight of the empty spool (tare weight)."),
|
||||
sa.Column("spool_weight", sa.Float(), nullable=True, comment="The weight of the empty spool (tare weight)."),
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
@@ -36,6 +36,6 @@ def upgrade() -> None:
|
||||
def downgrade() -> None:
|
||||
"""Perform the downgrade."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column("spool", "empty_weight")
|
||||
op.drop_column("spool", "spool_weight")
|
||||
op.drop_column("spool", "initial_weight")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
@@ -37,7 +37,7 @@ def upgrade() -> None:
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column(
|
||||
"empty_weight",
|
||||
"spool_weight",
|
||||
sa.Float(),
|
||||
nullable=False,
|
||||
),
|
||||
@@ -48,13 +48,13 @@ def upgrade() -> None:
|
||||
.where(filament.c.id == spool.c.filament_id)
|
||||
.scalar_subquery()
|
||||
)
|
||||
empty_weight = sa.select(filament.c.spool_weight).where(filament.c.id == spool.c.filament_id).scalar_subquery()
|
||||
spool_weight = sa.select(filament.c.spool_weight).where(filament.c.id == spool.c.filament_id).scalar_subquery()
|
||||
|
||||
set_initial_weight = sa.update(spool).values(initial_weight=initial_weight)
|
||||
op.execute(set_initial_weight)
|
||||
|
||||
set_empty_weight = sa.update(spool).values(empty_weight=empty_weight)
|
||||
op.execute(set_empty_weight)
|
||||
set_spool_weight = sa.update(spool).values(spool_weight=spool_weight)
|
||||
op.execute(set_spool_weight)
|
||||
pass
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user