diff --git a/CHANGELOG.md b/CHANGELOG.md index 89548604..ec1dff26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ml). ## testing +- [added] #414 add new vars in the settings file for wb. ## [2.5.0] - 2022-11-30 - [added] #407 erasure section with tabs in top. diff --git a/ereuse_devicehub/migrations/versions/af038a8a388c_add_settings_version_to_snapshots.py b/ereuse_devicehub/migrations/versions/af038a8a388c_add_settings_version_to_snapshots.py new file mode 100644 index 00000000..1b7b5a20 --- /dev/null +++ b/ereuse_devicehub/migrations/versions/af038a8a388c_add_settings_version_to_snapshots.py @@ -0,0 +1,35 @@ +"""add settings_version to snapshots + +Revision ID: af038a8a388c +Revises: 410aadae7652 +Create Date: 2022-11-30 16:21:05.768024 + +""" +import citext +import sqlalchemy as sa +from alembic import context, op + +# revision identifiers, used by Alembic. +revision = 'af038a8a388c' +down_revision = '410aadae7652' +branch_labels = None +depends_on = None + + +def get_inv(): + INV = context.get_x_argument(as_dictionary=True).get('inventory') + if not INV: + raise ValueError("Inventory value is not specified") + return INV + + +def upgrade(): + op.add_column( + 'snapshot', + sa.Column('settings_version', citext.CIText(), nullable=True), + schema=f'{get_inv()}', + ) + + +def downgrade(): + op.drop_column('snapshot', 'settings_version', schema=f'{get_inv()}') diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 87a9d392..ac38fad1 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -676,6 +676,7 @@ class Snapshot(JoinedWithOneDeviceMixin, ActionWithOneDevice): of time it took to complete. """ sid = Column(CIText(), nullable=True) + settings_version = Column(CIText(), nullable=True) is_server_erase = Column(Boolean(), nullable=True) def get_last_lifetimes(self):