Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

Commit

Permalink
Migrations: update id{tool,command}s
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Oct 28, 2017
1 parent bd4f4f7 commit d32bf02
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions fpr/migrations/0016_update_idtools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-

from __future__ import unicode_literals

from django.db import migrations


def data_migration(apps, schema_editor):
IDTool = apps.get_model('fpr', 'IDTool')
IDCommand = apps.get_model('fpr', 'IDCommand')

# Update Fido tool
tool = IDTool.objects.get(uuid='c33c9d4d-121f-4db1-aa31-3d248c705e44')
tool.version = '1.3.7'
tool._slug = 'fido-137'
tool.save()

# Create new command using the new version of Fido
old_command = IDCommand.objects.get(uuid='a8e45bc1-eb35-4545-885c-dd552f1fde9a', enabled=True)
IDCommand.objects.create(
uuid='76006ad7-a401-48f6-98f6-2efc01003276',
description=u'Identify using Fido',
config=old_command.config,
script=old_command.script,
script_type=old_command.script_type,
tool=tool,
enabled=True
)
old_command.enabled = False
old_command.save()

# Update Siegfried tool
tool = IDTool.objects.get(uuid='454df69d-5cc0-49fc-93e4-6fbb6ac659e7')
tool.version = '1.7.6'
tool._slug = 'siegfried-176'
tool.save()

# Create new command using the new version of Siegfried
old_command = IDCommand.objects.get(uuid='9d2cefc1-2bd2-44e4-8d55-6cf8151eecff', enabled=True)
IDCommand.objects.create(
uuid='df074736-e2f7-4102-b25d-569c099d410c',
description=old_command.description,
config=old_command.config,
script=old_command.script,
script_type=old_command.script_type,
tool=tool,
enabled=True
)
old_command.enabled = False
old_command.save()


class Migration(migrations.Migration):

dependencies = [
('fpr', '0015_pronom_92'),
]

operations = [
migrations.RunPython(data_migration),
]

0 comments on commit d32bf02

Please sign in to comment.