Files
Iliyan Angelov c67067a2a4 Mail
2025-09-14 23:24:25 +03:00

130 lines
6.5 KiB
Python

# Generated by Django 4.2.7 on 2025-09-14 20:10
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Contact',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
('email', models.EmailField(max_length=254)),
('phone', models.CharField(blank=True, max_length=20)),
('company', models.CharField(blank=True, max_length=100)),
('job_title', models.CharField(blank=True, max_length=100)),
('avatar', models.ImageField(blank=True, null=True, upload_to='contact_avatars/')),
('notes', models.TextField(blank=True)),
('website', models.URLField(blank=True)),
('birthday', models.DateField(blank=True, null=True)),
('address_line1', models.CharField(blank=True, max_length=100)),
('address_line2', models.CharField(blank=True, max_length=100)),
('city', models.CharField(blank=True, max_length=50)),
('state', models.CharField(blank=True, max_length=50)),
('postal_code', models.CharField(blank=True, max_length=20)),
('country', models.CharField(blank=True, max_length=50)),
('linkedin', models.URLField(blank=True)),
('twitter', models.URLField(blank=True)),
('facebook', models.URLField(blank=True)),
('is_favorite', models.BooleanField(default=False)),
('is_blocked', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'contacts',
'ordering': ['first_name', 'last_name'],
},
),
migrations.CreateModel(
name='ContactInteraction',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('interaction_type', models.CharField(choices=[('email_sent', 'Email Sent'), ('email_received', 'Email Received'), ('phone_call', 'Phone Call'), ('meeting', 'Meeting'), ('note', 'Note')], max_length=20)),
('subject', models.CharField(blank=True, max_length=200)),
('description', models.TextField(blank=True)),
('date', models.DateTimeField(auto_now_add=True)),
('contact', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='interactions', to='contacts.contact')),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'contact_interactions',
'ordering': ['-date'],
},
),
migrations.CreateModel(
name='ContactImport',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('filename', models.CharField(max_length=255)),
('file', models.FileField(upload_to='contact_imports/')),
('status', models.CharField(choices=[('pending', 'Pending'), ('processing', 'Processing'), ('completed', 'Completed'), ('failed', 'Failed')], default='pending', max_length=20)),
('total_contacts', models.IntegerField(default=0)),
('imported_contacts', models.IntegerField(default=0)),
('failed_contacts', models.IntegerField(default=0)),
('error_log', models.TextField(blank=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('completed_at', models.DateTimeField(blank=True, null=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contact_imports', to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'contact_imports',
'ordering': ['-created_at'],
},
),
migrations.CreateModel(
name='ContactGroup',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('description', models.TextField(blank=True)),
('color', models.CharField(default='#007bff', max_length=7)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contact_groups', to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'contact_groups',
'ordering': ['name'],
'unique_together': {('user', 'name')},
},
),
migrations.AddField(
model_name='contact',
name='group',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='contacts', to='contacts.contactgroup'),
),
migrations.AddField(
model_name='contact',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contacts', to=settings.AUTH_USER_MODEL),
),
migrations.AddIndex(
model_name='contact',
index=models.Index(fields=['user', 'email'], name='contacts_user_id_bbbaf8_idx'),
),
migrations.AddIndex(
model_name='contact',
index=models.Index(fields=['user', 'is_favorite'], name='contacts_user_id_80e197_idx'),
),
migrations.AddIndex(
model_name='contact',
index=models.Index(fields=['user', 'is_blocked'], name='contacts_user_id_0ee143_idx'),
),
migrations.AlterUniqueTogether(
name='contact',
unique_together={('user', 'email')},
),
]