78 lines
3.3 KiB
Python
78 lines
3.3 KiB
Python
# Generated manually for adding SiteAIBudgetAllocation model
|
|
# Run: python manage.py migrate
|
|
|
|
from django.db import migrations, models
|
|
from django.core.validators import MinValueValidator
|
|
import django.db.models.deletion
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('billing', '0001_initial'), # Adjust based on actual dependency
|
|
('igny8_core_auth', '0001_initial'), # Adjust based on actual dependency
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='SiteAIBudgetAllocation',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('ai_function', models.CharField(
|
|
max_length=50,
|
|
choices=[
|
|
('clustering', 'Keyword Clustering (Stage 1)'),
|
|
('idea_generation', 'Ideas Generation (Stage 2)'),
|
|
('content_generation', 'Content Generation (Stage 4)'),
|
|
('image_prompt', 'Image Prompt Extraction (Stage 5)'),
|
|
('image_generation', 'Image Generation (Stage 6)'),
|
|
],
|
|
help_text='AI function to allocate budget for'
|
|
)),
|
|
('allocation_percentage', models.PositiveIntegerField(
|
|
default=20,
|
|
validators=[MinValueValidator(0)],
|
|
help_text='Percentage of credit budget allocated to this function (0-100)'
|
|
)),
|
|
('is_enabled', models.BooleanField(
|
|
default=True,
|
|
help_text='Whether this function is enabled for automation'
|
|
)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('account', models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name='site_ai_budget_allocations',
|
|
to='igny8_core_auth.account'
|
|
)),
|
|
('site', models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name='ai_budget_allocations',
|
|
to='igny8_core_auth.site',
|
|
help_text='Site this allocation belongs to'
|
|
)),
|
|
],
|
|
options={
|
|
'verbose_name': 'Site AI Budget Allocation',
|
|
'verbose_name_plural': 'Site AI Budget Allocations',
|
|
'db_table': 'igny8_site_ai_budget_allocations',
|
|
'ordering': ['site', 'ai_function'],
|
|
},
|
|
),
|
|
migrations.AddConstraint(
|
|
model_name='siteaibudgetallocation',
|
|
constraint=models.UniqueConstraint(
|
|
fields=['site', 'ai_function'],
|
|
name='unique_site_ai_function'
|
|
),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='siteaibudgetallocation',
|
|
index=models.Index(fields=['site', 'is_enabled'], name='igny8_site_ai_site_enabled_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='siteaibudgetallocation',
|
|
index=models.Index(fields=['account', 'site'], name='igny8_site_ai_account_site_idx'),
|
|
),
|
|
]
|