-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1369 from bcgov/fix/daniel-data-fixes-1321
fix: Data and Label Fixes
- Loading branch information
Showing
5 changed files
with
64 additions
and
7 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
backend/lcfs/db/migrations/versions/2024-12-04-23-00_8491890dd688.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
"""Data Fixes | ||
Revision ID: 8491890dd688 | ||
Revises: aeaa26f5cdd5 | ||
Create Date: 2024-12-04 23:00:10.708533 | ||
""" | ||
|
||
from alembic import op | ||
from sqlalchemy import update | ||
|
||
from lcfs.db.models import FuelType, AllocationTransactionType | ||
from lcfs.db.models.fuel.FuelType import QuantityUnitsEnum | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "8491890dd688" | ||
down_revision = "aeaa26f5cdd5" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.execute( | ||
update(FuelType) | ||
.where(FuelType.fuel_type_id == 6) | ||
.values(units=QuantityUnitsEnum.Kilograms) | ||
) | ||
|
||
op.execute( | ||
update(FuelType).where(FuelType.fuel_type_id == 20).values(fossil_derived=False) | ||
) | ||
|
||
# Update 'type' and 'description' in allocation_transaction_type where allocation_transaction_type_id = 2 | ||
op.execute( | ||
update(AllocationTransactionType) | ||
.where(AllocationTransactionType.allocation_transaction_type_id == 2) | ||
.values( | ||
type="Allocated to", | ||
description="Fuel allocated to another supplier under an allocation agreement", | ||
) | ||
) | ||
|
||
# Update 'type' and 'description' in allocation_transaction_type where allocation_transaction_type_id = 1 | ||
op.execute( | ||
update(AllocationTransactionType) | ||
.where(AllocationTransactionType.allocation_transaction_type_id == 1) | ||
.values( | ||
type="Allocated from", | ||
description="Fuel allocated from another supplier under an allocation agreement", | ||
) | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters