Skip to content

fix: seed default charging price tiers on self-healing fallback#28

Merged
markoceri merged 1 commit into
mainfrom
fix/issue-27-charging-tiers-missing
Jun 24, 2026
Merged

fix: seed default charging price tiers on self-healing fallback#28
markoceri merged 1 commit into
mainfrom
fix/issue-27-charging-tiers-missing

Conversation

@markoceri

Copy link
Copy Markdown
Owner

When Base.metadata.create_all pre-creates the charging_price_tiers and charging_time_bands tables, Alembic is stamped to head without running migration 0007's upgrade() function, leaving both tables empty. This causes the Settings UI to show no tier input fields.

Added a self-healing fallback in run_alembic_upgrade() that idempotently seeds the four default tiers (home_grid, home_solar, public_ac, public_dc) and the three default Italian ARERA time-of-use bands when the tables are empty — matching the exact seed logic from migration 0007.

Closes #27

When Base.metadata.create_all pre-creates the charging_price_tiers and
charging_time_bands tables, Alembic is stamped to head without running
migration 0007's upgrade() function, leaving both tables empty. This
causes the Settings UI to show no tier input fields.

Added a self-healing fallback in run_alembic_upgrade() that idempotently
seeds the four default tiers (home_grid, home_solar, public_ac, public_dc)
and the three default Italian ARERA time-of-use bands when the tables are
empty — matching the exact seed logic from migration 0007.

Closes #27
@markoceri markoceri self-assigned this Jun 24, 2026
@markoceri markoceri added the bug Something isn't working label Jun 24, 2026
@markoceri markoceri merged commit dac817d into main Jun 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Charging price tiers not available to edit

1 participant