Skip to content

Commit

Permalink
[MIGRATION] The create_table function does not create new fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh5 committed Apr 21, 2021
1 parent 06166c1 commit d103d6c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion unmanic/migrations/013_add_update_column_to_plugin_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ def migrate(migrator, database, fake=False, **kwargs):
"""Write your migrations here."""
# Add enable_hardware_accelerated_decoding field to Plugins Model
migrator.create_table(Plugins)
# Add keep_original_container field to Settings Model
if any(cm for cm in database.get_columns('plugins') if cm.name == 'update_available'):
# Remove the current column
migrator.remove_fields(Plugins, 'update_available', cascade=True)
migrator.add_fields(Plugins, update_available=pw.BooleanField(null=False, default=False))


def rollback(migrator, database, fake=False, **kwargs):
"""Write your rollback migrations here."""
migrator.remove_fields('plugins', 'update_available', cascade=True)
migrator.remove_fields(Plugins, 'update_available', cascade=True)

0 comments on commit d103d6c

Please sign in to comment.