from django.core.management.base import (
    BaseCommand,
    CommandError,
)

from ._emails_migration import migrate_wrong_domain_emails


class Command(BaseCommand):
    help = 'Мигрирует Staff.work_email в контакты для login <> login_mail'

    def handle(self, *args, **options):
        try:
            migrate_wrong_domain_emails()
        except Exception as e:
            raise CommandError(e)
