from django.db import migrations


def assign_access_key(apps, schema):
    vatlayer_configuration = (
        apps.get_model("plugins", "PluginConfiguration")
        .objects.filter(identifier="mirumee.taxes.vatlayer")
        .first()
    )

    if vatlayer_configuration:
        vatlayer_configuration.active = False
        vatlayer_configuration.save()


class Migration(migrations.Migration):

    dependencies = [
        ("plugins", "0003_auto_20200429_0142"),
    ]

    operations = [
        migrations.RunPython(assign_access_key),
    ]

from django.db import migrations


def deactivate_vatlayer(apps, schema):
    vatlayer_configuration = (
        apps.get_model("plugins", "PluginConfiguration")
        .objects.filter(identifier="mirumee.taxes.vatlayer")
        .first()
    )

    if vatlayer_configuration:
        vatlayer_configuration.active = False
        vatlayer_configuration.save()


class Migration(migrations.Migration):

    dependencies = [
        ("plugins", "0003_auto_20200429_0142"),
    ]

    operations = [
        migrations.RunPython(deactivate_vatlayer),
    ]

Change migration name to more proper
Change migration name to more proper

  from django.db import migrations
  
  
- def assign_access_key(apps, schema):
+ def deactivate_vatlayer(apps, schema):
      vatlayer_configuration = (
          apps.get_model("plugins", "PluginConfiguration")
          .objects.filter(identifier="mirumee.taxes.vatlayer")
          .first()
      )
  
      if vatlayer_configuration:
          vatlayer_configuration.active = False
          vatlayer_configuration.save()
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ("plugins", "0003_auto_20200429_0142"),
      ]
  
      operations = [
-         migrations.RunPython(assign_access_key),
+         migrations.RunPython(deactivate_vatlayer),
      ]
  
Change migration name to more proper
## Code Before:
from django.db import migrations


def assign_access_key(apps, schema):
    vatlayer_configuration = (
        apps.get_model("plugins", "PluginConfiguration")
        .objects.filter(identifier="mirumee.taxes.vatlayer")
        .first()
    )

    if vatlayer_configuration:
        vatlayer_configuration.active = False
        vatlayer_configuration.save()


class Migration(migrations.Migration):

    dependencies = [
        ("plugins", "0003_auto_20200429_0142"),
    ]

    operations = [
        migrations.RunPython(assign_access_key),
    ]

## Instruction:
Change migration name to more proper
## Code After:
from django.db import migrations


def deactivate_vatlayer(apps, schema):
    vatlayer_configuration = (
        apps.get_model("plugins", "PluginConfiguration")
        .objects.filter(identifier="mirumee.taxes.vatlayer")
        .first()
    )

    if vatlayer_configuration:
        vatlayer_configuration.active = False
        vatlayer_configuration.save()


class Migration(migrations.Migration):

    dependencies = [
        ("plugins", "0003_auto_20200429_0142"),
    ]

    operations = [
        migrations.RunPython(deactivate_vatlayer),
    ]
