Skip to content

Commit

Permalink
fix: Add Marine Use
Browse files Browse the repository at this point in the history
* Add Marine end use
* Link marine end use to Electricity/Diesel
  • Loading branch information
dhaselhan committed Dec 18, 2024
1 parent cb5f7aa commit 68cd091
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""Add Marine End Use
Revision ID: 909969082dfb
Revises: 851e09cf8661
Create Date: 2024-12-18 19:43:06.680781
"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "909969082dfb"
down_revision = "851e09cf8661"
branch_labels = None
depends_on = None


def upgrade() -> None:
op.execute(
"""
INSERT INTO "end_use_type" ("type", "intended_use", "create_user", "update_user") VALUES ('Marine', 't', 'no_user', 'no_user');
"""
)

op.execute(
"""
INSERT INTO "public"."energy_effectiveness_ratio" ("fuel_category_id", "fuel_type_id", "end_use_type_id", "ratio", "create_user", "update_user", "effective_status") VALUES (2, 3, (SELECT end_use_type_id FROM "end_use_type" WHERE "type" = 'Marine'), 2.5, 'no_user', 'no_user', 't');
"""
)


def downgrade() -> None:
# Remove the inserted energy_effectiveness_ratio entry
op.execute(
"""
DELETE FROM "public"."energy_effectiveness_ratio"
WHERE end_use_type_id = (SELECT end_use_type_id FROM "end_use_type" WHERE "type" = 'Marine');
"""
)

# Remove the inserted end_use_type entry
op.execute(
"""
DELETE FROM "end_use_type"
WHERE "type" = 'Marine';
"""
)
12 changes: 12 additions & 0 deletions backend/lcfs/db/seeders/common/seed_fuel_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,11 @@
"end_use_type_id": 23,
"type": "Other (i.e. road transportation)",
"intended_use": true
},
{
"end_use_type_id": 24,
"type": "Marine",
"intended_use": true
}
],
"unit_of_measures": [
Expand Down Expand Up @@ -686,6 +691,13 @@
"fuel_type_id": 7,
"end_use_type_id": 23,
"ratio": 0.9
},
{
"eer_id": 31,
"fuel_category_id": 2,
"fuel_type_id": 3,
"end_use_type_id": 24,
"ratio": 2.5
}
],
"energy_densities": [
Expand Down

0 comments on commit 68cd091

Please sign in to comment.