spine-tools / Spine-Database-API

Database interface to Spine generic data model
https://www.tools-for-energy-system-modelling.org/
GNU Lesser General Public License v3.0
6 stars 5 forks source link

Use the default value for is_active when migrating to active_by_default #348

Closed soininen closed 5 months ago

soininen commented 5 months ago

This PR adds a compatibility transformation to the migration script that adds the active_by_default column to entity_class table. The script picks up the default value of is_active (or equivalent) parameter and uses that to determine the initial value of active_by_default. The default value is set to None afterwards to prevent the transformation from overriding active_by_default on commit.

This also fixes the analogous compatibility transform for entity alternatives that had a broken entity_alternative table update statement.

Fixes #316, spine-tools/Spine-Toolbox#2535

Checklist before merging

manuelma commented 5 months ago

Thank you very much for this @soininen - amazing job!