-
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 #1839 from bcgov/fix/alex-uci-opts-1825
fix: updated intended use flags on correct records
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
backend/lcfs/db/migrations/versions/2025-01-28-16-15_0d8e7ee6a6e0.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,47 @@ | ||
"""Update intended use flags | ||
Revision ID: 0d8e7ee6a6e0 | ||
Revises: 26bb41f15dc4 | ||
Create Date: 2025-01-28 16:15:20.208093 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "0d8e7ee6a6e0" | ||
down_revision = "26bb41f15dc4" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# Ensure that only the specified types have intended_use set to TRUE | ||
op.execute( | ||
""" | ||
UPDATE end_use_type | ||
SET intended_use = CASE | ||
WHEN type IN ( | ||
'Light duty motor vehicles', | ||
'Battery bus', | ||
'Battery truck', | ||
'Cargo handling equipment', | ||
'Fixed guiderail', | ||
'Ground support equipment', | ||
'Heavy forklift', | ||
'Marine', | ||
'Shore power', | ||
'Trolley bus', | ||
'Other', | ||
'Any', | ||
'Aircraft' | ||
) THEN TRUE | ||
ELSE FALSE | ||
END; | ||
""" | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
pass |