

from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import User
from django.db import migrations, models

USERNAME = settings.ECOMMERCE_SERVICE_WORKER_USERNAME
EMAIL = USERNAME + '@fake.email'

def forwards(apps, schema_editor):
    """Add the service user."""
    User = get_user_model()
    user, created = User.objects.get_or_create(username=USERNAME, email=EMAIL)
    if created:
        user.set_unusable_password()
        user.save()

def backwards(apps, schema_editor):
    """Remove the service user."""
    User.objects.get(username=USERNAME, email=EMAIL).delete()

class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('user_api', '0002_retirementstate_userretirementstatus'),
    ]

    operations = [
        migrations.RunPython(forwards, backwards),
    ]



from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import User
from django.db import migrations, models

USERNAME = settings.ECOMMERCE_SERVICE_WORKER_USERNAME
EMAIL = USERNAME + '@fake.email'

def forwards(apps, schema_editor):
    """Add the service user."""
    User = get_user_model()
    user, created = User.objects.get_or_create(username=USERNAME, email=EMAIL)
    if created:
        user.set_unusable_password()
        user.save()

def backwards(apps, schema_editor):
    """Remove the service user."""
    User.objects.get(username=USERNAME, email=EMAIL).delete()

class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('user_api', '0002_retirementstate_userretirementstatus'),
        ('student', '0033_userprofile_state'),
    ]

    operations = [
        migrations.RunPython(forwards, backwards),
    ]

Fix sandboax builds, because of signal chains, UserProfile table must be predent before adding a User
Fix sandboax builds, because of signal chains, UserProfile table must be predent before adding a User

  
  
  from django.conf import settings
  from django.contrib.auth import get_user_model
  from django.contrib.auth.models import User
  from django.db import migrations, models
  
  USERNAME = settings.ECOMMERCE_SERVICE_WORKER_USERNAME
  EMAIL = USERNAME + '@fake.email'
  
  def forwards(apps, schema_editor):
      """Add the service user."""
      User = get_user_model()
      user, created = User.objects.get_or_create(username=USERNAME, email=EMAIL)
      if created:
          user.set_unusable_password()
          user.save()
  
  def backwards(apps, schema_editor):
      """Remove the service user."""
      User.objects.get(username=USERNAME, email=EMAIL).delete()
  
  class Migration(migrations.Migration):
  
      dependencies = [
          migrations.swappable_dependency(settings.AUTH_USER_MODEL),
          ('user_api', '0002_retirementstate_userretirementstatus'),
+         ('student', '0033_userprofile_state'),
      ]
  
      operations = [
          migrations.RunPython(forwards, backwards),
      ]
  
Fix sandboax builds, because of signal chains, UserProfile table must be predent before adding a User
## Code Before:


from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import User
from django.db import migrations, models

USERNAME = settings.ECOMMERCE_SERVICE_WORKER_USERNAME
EMAIL = USERNAME + '@fake.email'

def forwards(apps, schema_editor):
    """Add the service user."""
    User = get_user_model()
    user, created = User.objects.get_or_create(username=USERNAME, email=EMAIL)
    if created:
        user.set_unusable_password()
        user.save()

def backwards(apps, schema_editor):
    """Remove the service user."""
    User.objects.get(username=USERNAME, email=EMAIL).delete()

class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('user_api', '0002_retirementstate_userretirementstatus'),
    ]

    operations = [
        migrations.RunPython(forwards, backwards),
    ]

## Instruction:
Fix sandboax builds, because of signal chains, UserProfile table must be predent before adding a User
## Code After:


from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import User
from django.db import migrations, models

USERNAME = settings.ECOMMERCE_SERVICE_WORKER_USERNAME
EMAIL = USERNAME + '@fake.email'

def forwards(apps, schema_editor):
    """Add the service user."""
    User = get_user_model()
    user, created = User.objects.get_or_create(username=USERNAME, email=EMAIL)
    if created:
        user.set_unusable_password()
        user.save()

def backwards(apps, schema_editor):
    """Remove the service user."""
    User.objects.get(username=USERNAME, email=EMAIL).delete()

class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('user_api', '0002_retirementstate_userretirementstatus'),
        ('student', '0033_userprofile_state'),
    ]

    operations = [
        migrations.RunPython(forwards, backwards),
    ]
