# Generated by Django 5.2.7 on 2025-10-03 13:31 import accounts.utils.helper import django.contrib.auth.models import django.contrib.auth.validators import django.contrib.postgres.indexes import django.db.models.deletion import django.utils.timezone from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0012_alter_user_first_name_max_length'), ('core', '0001_initial'), ] operations = [ migrations.CreateModel( name='CustomUser', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('password', models.CharField(max_length=128, verbose_name='password')), ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), ('email', models.EmailField(help_text='Primary email address used for account identification', max_length=254, unique=True, verbose_name='email address')), ('role', models.CharField(choices=[('user', 'User'), ('admin', 'Administrator')], default='user', help_text='User role determines access level', max_length=20)), ('profile_picture', models.ImageField(blank=True, help_text='User profile picture/avatar', null=True, upload_to='avatars/')), ('email_verified', models.BooleanField(default=False, help_text='Indicates if the email address has been verified')), ('phone_verified', models.BooleanField(default=False, help_text='Indicates if the phone number has been verified')), ('two_factor_enabled', models.BooleanField(default=False, help_text='Indicates if two-factor authentication is enabled')), ('last_password_change', models.DateTimeField(auto_now_add=True, help_text='Timestamp of the last password change')), ('social_auth_providers', models.JSONField(default=accounts.utils.helper.get_default_social_auth_providers, help_text='Connected social authentication providers')), ('last_active', models.DateTimeField(blank=True, help_text="Timestamp of the user's last platform activity", null=True)), ('login_count', models.PositiveIntegerField(default=0, help_text='Number of times the user has logged in')), ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to.', related_name='customuser_set', related_query_name='customuser', to='auth.group', verbose_name='groups')), ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='customuser_set', related_query_name='customuser', to='auth.permission', verbose_name='user permissions')), ], options={ 'verbose_name': 'user', 'verbose_name_plural': 'users', 'ordering': ['-date_joined'], }, managers=[ ('objects', django.contrib.auth.models.UserManager()), ], ), migrations.CreateModel( name='UserContact', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('address_line1', models.CharField(blank=True, max_length=255, null=True)), ('address_line2', models.CharField(blank=True, max_length=255, null=True)), ('city', models.CharField(blank=True, max_length=100, null=True)), ('state', models.CharField(blank=True, max_length=100, null=True)), ('postal_code', models.CharField(blank=True, max_length=20, null=True)), ('contact_info', models.JSONField(blank=True, default=accounts.utils.helper.get_default_user_contact_info, help_text='Structured contact information including phones and social profiles', null=True)), ('billing_details', models.JSONField(blank=True, default=dict, help_text='Billing information for invoicing', null=True)), ('timezone', models.CharField(blank=True, help_text='User timezone', max_length=100, null=True)), ('availability', models.JSONField(blank=True, default=dict, help_text='User availability schedule', null=True)), ('country', models.ForeignKey(default=1, help_text='Country of residence', null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to='core.country')), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='contact', to=settings.AUTH_USER_MODEL)), ], ), migrations.AddIndex( model_name='customuser', index=models.Index(fields=['email'], name='user_email_idx'), ), migrations.AddIndex( model_name='customuser', index=models.Index(fields=['username'], name='user_username_idx'), ), migrations.AddIndex( model_name='customuser', index=models.Index(fields=['role'], name='user_role_idx'), ), migrations.AddIndex( model_name='customuser', index=models.Index(fields=['last_active'], name='user_last_active_idx'), ), migrations.AddIndex( model_name='customuser', index=models.Index(fields=['date_joined'], name='user_date_joined_idx'), ), migrations.AddIndex( model_name='customuser', index=models.Index(fields=['email_verified'], name='user_email_verified_idx'), ), migrations.AddIndex( model_name='customuser', index=models.Index(fields=['email_verified', 'last_active'], name='user_verified_active_idx'), ), migrations.AddIndex( model_name='customuser', index=django.contrib.postgres.indexes.GinIndex(fields=['social_auth_providers'], name='user_social_auth_gin_idx'), ), migrations.AddIndex( model_name='usercontact', index=models.Index(fields=['user'], name='user_contact_user_idx'), ), migrations.AddIndex( model_name='usercontact', index=django.contrib.postgres.indexes.GinIndex(fields=['contact_info'], name='user_contact_info_gin_idx'), ), migrations.AddIndex( model_name='usercontact', index=django.contrib.postgres.indexes.GinIndex(fields=['billing_details'], name='user_billing_gin_idx'), ), migrations.AddIndex( model_name='usercontact', index=django.contrib.postgres.indexes.GinIndex(fields=['availability'], name='user_availability_gin_idx'), ), ]