-
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 #1767 from bcgov/fix/daniel-fix-line2-calcs-1738
fix: Move renewable flag to DB
- Loading branch information
Showing
5 changed files
with
67 additions
and
25 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
backend/lcfs/db/migrations/versions/2025-01-22-00-04_0576833c005d.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,55 @@ | ||
"""Add renewable to Fuel Types | ||
Revision ID: 0576833c005d | ||
Revises: ec826b9226df | ||
Create Date: 2025-01-22 00:04:37.043142 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "0576833c005d" | ||
down_revision = "ec826b9226df" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column( | ||
"fuel_type", | ||
sa.Column( | ||
"renewable", | ||
sa.Boolean(), | ||
server_default=sa.text("FALSE"), | ||
nullable=False, | ||
comment="Indicates whether the fuel should be categorized as renewable", | ||
), | ||
) | ||
|
||
# Update specific fuel types to set renewable = TRUE | ||
op.execute( | ||
""" | ||
UPDATE fuel_type | ||
SET renewable = TRUE | ||
WHERE fuel_type IN ( | ||
'Renewable gasoline', | ||
'Ethanol', | ||
'Renewable naphtha', | ||
'Biodiesel', | ||
'HDRD', | ||
'Other diesel fuel', | ||
'Alternative jet fuel', | ||
'Other' | ||
) | ||
""" | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column("fuel_type", "renewable") | ||
# ### end Alembic commands ### |
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