From 15a178ab42e680c5d02de1b7f0314e1e70dea49a Mon Sep 17 00:00:00 2001 From: tahiru Date: Tue, 5 Dec 2023 09:14:04 +0000 Subject: [PATCH] migration files created for campaign models --- .../migrations/0001_initial.py | 400 ++++++++++++++++++ src/apps__campaigns/models.py | 2 +- 2 files changed, 401 insertions(+), 1 deletion(-) create mode 100644 src/apps__campaigns/migrations/0001_initial.py diff --git a/src/apps__campaigns/migrations/0001_initial.py b/src/apps__campaigns/migrations/0001_initial.py new file mode 100644 index 000000000..2f731149c --- /dev/null +++ b/src/apps__campaigns/migrations/0001_initial.py @@ -0,0 +1,400 @@ +# Generated by Django 3.1.14 on 2023-12-05 09:13 + +from django.db import migrations, models +import django.db.models.deletion +import uuid + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('database', '0142_auto_20231103_1404'), + ] + + operations = [ + migrations.CreateModel( + name='Campaign', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('title', models.CharField(max_length=255)), + ('description', models.TextField(blank=True)), + ('start_date', models.DateField()), + ('end_date', models.DateTimeField(blank=True, null=True)), + ('is_approved', models.BooleanField(default=False)), + ('is_published', models.BooleanField(default=False)), + ('is_global', models.BooleanField(default=False)), + ('is_template', models.BooleanField(default=False)), + ], + options={ + 'db_table': 'Campaigns', + }, + ), + migrations.CreateModel( + name='CampaignAccount', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('name', models.CharField(max_length=255)), + ('subdomain', models.CharField(max_length=100, unique=True)), + ('community', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='database.community')), + ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='database.userprofile')), + ], + options={ + 'ordering': ('-created_at',), + }, + ), + migrations.CreateModel( + name='CampaignTechnology', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaign')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='Technology', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('name', models.CharField(max_length=255)), + ('description', models.TextField(blank=True)), + ('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='database.media')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='Vendor', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('name', models.CharField(max_length=255)), + ('description', models.TextField(blank=True)), + ('email', models.EmailField(blank=True, max_length=254, null=True)), + ('website', models.CharField(blank=True, max_length=100, null=True)), + ('phone_number', models.CharField(blank=True, max_length=100, null=True)), + ('zipcode', models.CharField(blank=True, max_length=100, null=True)), + ('is_verified', models.BooleanField(default=False)), + ('service_area', models.CharField(blank=True, max_length=100, null=True)), + ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='vendor_creator', to='database.userprofile')), + ('logo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='database.media')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='TechnologyVendor', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('technology', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.technology')), + ('vendor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.vendor')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='TechnologyOverview', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('title', models.CharField(max_length=255)), + ('description', models.TextField(blank=True)), + ('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='database.media')), + ('technology', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.technology')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='TechnologyCoach', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('community', models.CharField(blank=True, max_length=255, null=True)), + ('technology', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.technology')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='database.userprofile')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='Partner', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('name', models.CharField(max_length=100)), + ('website', models.CharField(blank=True, max_length=100, null=True)), + ('phone_number', models.CharField(blank=True, max_length=100, null=True)), + ('email', models.CharField(blank=True, max_length=100, null=True)), + ('logo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='partner_logo', to='database.media')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CustomCampaignAccountDomain', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('domain_name', models.CharField(max_length=100, unique=True)), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaignaccount')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='Comment', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('text', models.TextField(blank=True, null=True)), + ('status', models.CharField(blank=True, max_length=100, null=True)), + ('campaign_technology', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaign')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='database.userprofile')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CampaignTechnologyView', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('ip_address', models.CharField(blank=True, max_length=100, null=True)), + ('user_agent', models.CharField(blank=True, max_length=100, null=True)), + ('campaign_technology', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaigntechnology')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CampaignTechnologyLike', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('zipcode', models.CharField(blank=True, max_length=100, null=True)), + ('campaign_technology', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaigntechnology')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='database.userprofile')), + ], + options={ + 'abstract': False, + }, + ), + migrations.AddField( + model_name='campaigntechnology', + name='technology', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.technology'), + ), + migrations.CreateModel( + name='CampaignPartner', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaign')), + ('partner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.partner')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CampaignManager', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('is_key_contact', models.BooleanField(blank=True, default=False)), + ('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaign')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='database.userprofile')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CampaignLink', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('visits', models.PositiveBigIntegerField(default=0)), + ('email', models.EmailField(blank=True, max_length=254, null=True)), + ('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaign')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CampaignLike', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('zipcode', models.CharField(blank=True, max_length=100, null=True)), + ('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaign')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='database.userprofile')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CampaignFollow', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('zipcode', models.CharField(blank=True, max_length=100, null=True)), + ('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaign')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='database.userprofile')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CampaignEvent', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('is_featured', models.BooleanField(blank=True, default=False)), + ('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaign')), + ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='database.event')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CampaignConfiguration', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('theme', models.JSONField(blank=True, null=True)), + ('navigation', models.JSONField(blank=True, null=True)), + ('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaign')), + ], + options={ + 'db_table': 'CampaignConfiguration', + }, + ), + migrations.CreateModel( + name='CampaignCommunity', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaign')), + ('community', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='database.community')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CampaignAccountAdmin', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('is_deleted', models.BooleanField(default=False)), + ('info', models.JSONField(blank=True, null=True)), + ('role', models.CharField(blank=True, max_length=255)), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaignaccount')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='database.userprofile')), + ], + options={ + 'abstract': False, + }, + ), + migrations.AddField( + model_name='campaign', + name='account', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apps__campaigns.campaignaccount'), + ), + migrations.AddField( + model_name='campaign', + name='logo', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='database.media'), + ), + migrations.AddField( + model_name='campaign', + name='owner', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='database.userprofile'), + ), + ] diff --git a/src/apps__campaigns/models.py b/src/apps__campaigns/models.py index c4cb61969..a224c5a6f 100644 --- a/src/apps__campaigns/models.py +++ b/src/apps__campaigns/models.py @@ -272,7 +272,7 @@ class Vendor(BaseModel): phone_number = models.CharField(blank=True, null=True, max_length=SHORT_STR_LEN) zipcode = models.CharField(blank=True, null=True, max_length=SHORT_STR_LEN) is_verified = models.BooleanField(default=False) - creator = models.ForeignKey(UserProfile, on_delete=models.CASCADE, null=True, blank=True) + creator = models.ForeignKey(UserProfile, on_delete=models.CASCADE, null=True, blank=True, related_name="vendor_creator") service_area = models.CharField(blank=True, null=True, max_length=SHORT_STR_LEN) def __str__(self):