Update app labels for billing, writer, and planner models; fix foreign key references in automation migrations

- Set app labels for CreditTransaction and CreditUsageLog models to 'billing'.
- Updated app labels for Tasks, Content, and Images models to 'writer'.
- Changed foreign key references in automation migrations from 'account' to 'tenant' for consistency.
This commit is contained in:
IGNY8 VPS (Salman)
2025-11-16 22:37:16 +00:00
parent 1c2c9354ba
commit 1134285a12
4 changed files with 13 additions and 5 deletions

View File

@@ -24,6 +24,7 @@ class CreditTransaction(AccountBaseModel):
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
class Meta: class Meta:
app_label = 'billing'
db_table = 'igny8_credit_transactions' db_table = 'igny8_credit_transactions'
ordering = ['-created_at'] ordering = ['-created_at']
indexes = [ indexes = [
@@ -61,6 +62,7 @@ class CreditUsageLog(AccountBaseModel):
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
class Meta: class Meta:
app_label = 'billing'
db_table = 'igny8_credit_usage_logs' db_table = 'igny8_credit_usage_logs'
ordering = ['-created_at'] ordering = ['-created_at']
indexes = [ indexes = [

View File

@@ -29,7 +29,7 @@ class Tasks(SiteSectorBaseModel):
description = models.TextField(blank=True, null=True) description = models.TextField(blank=True, null=True)
keywords = models.CharField(max_length=500, blank=True) # Comma-separated keywords (legacy) keywords = models.CharField(max_length=500, blank=True) # Comma-separated keywords (legacy)
cluster = models.ForeignKey( cluster = models.ForeignKey(
'planning.Clusters', 'planner.Clusters',
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
null=True, null=True,
blank=True, blank=True,
@@ -37,13 +37,13 @@ class Tasks(SiteSectorBaseModel):
limit_choices_to={'sector': models.F('sector')} limit_choices_to={'sector': models.F('sector')}
) )
keyword_objects = models.ManyToManyField( keyword_objects = models.ManyToManyField(
'planning.Keywords', 'planner.Keywords',
blank=True, blank=True,
related_name='tasks', related_name='tasks',
help_text="Individual keywords linked to this task" help_text="Individual keywords linked to this task"
) )
idea = models.ForeignKey( idea = models.ForeignKey(
'planning.ContentIdeas', 'planner.ContentIdeas',
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
null=True, null=True,
blank=True, blank=True,
@@ -68,6 +68,7 @@ class Tasks(SiteSectorBaseModel):
updated_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True)
class Meta: class Meta:
app_label = 'writer'
db_table = 'igny8_tasks' db_table = 'igny8_tasks'
ordering = ['-created_at'] ordering = ['-created_at']
verbose_name = 'Task' verbose_name = 'Task'
@@ -115,6 +116,7 @@ class Content(SiteSectorBaseModel):
updated_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True)
class Meta: class Meta:
app_label = 'writer'
db_table = 'igny8_content' db_table = 'igny8_content'
ordering = ['-generated_at'] ordering = ['-generated_at']
verbose_name = 'Content' verbose_name = 'Content'
@@ -172,6 +174,7 @@ class Images(SiteSectorBaseModel):
updated_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True)
class Meta: class Meta:
app_label = 'writer'
db_table = 'igny8_images' db_table = 'igny8_images'
ordering = ['content', 'position', '-created_at'] ordering = ['content', 'position', '-created_at']
verbose_name = 'Image' verbose_name = 'Image'

View File

@@ -15,6 +15,7 @@ class Clusters(SiteSectorBaseModel):
updated_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True)
class Meta: class Meta:
app_label = 'planner'
db_table = 'igny8_clusters' db_table = 'igny8_clusters'
ordering = ['name'] ordering = ['name']
verbose_name = 'Cluster' verbose_name = 'Cluster'
@@ -74,6 +75,7 @@ class Keywords(SiteSectorBaseModel):
updated_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True)
class Meta: class Meta:
app_label = 'planner'
db_table = 'igny8_keywords' db_table = 'igny8_keywords'
ordering = ['-created_at'] ordering = ['-created_at']
verbose_name = 'Keyword' verbose_name = 'Keyword'
@@ -178,6 +180,7 @@ class ContentIdeas(SiteSectorBaseModel):
updated_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True)
class Meta: class Meta:
app_label = 'planner'
db_table = 'igny8_content_ideas' db_table = 'igny8_content_ideas'
ordering = ['-created_at'] ordering = ['-created_at']
verbose_name = 'Content Idea' verbose_name = 'Content Idea'

View File

@@ -31,7 +31,7 @@ class Migration(migrations.Migration):
('last_executed_at', models.DateTimeField(blank=True, null=True)), ('last_executed_at', models.DateTimeField(blank=True, null=True)),
('execution_count', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0)])), ('execution_count', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0)])),
('metadata', models.JSONField(default=dict, help_text='Additional metadata')), ('metadata', models.JSONField(default=dict, help_text='Additional metadata')),
('account', models.ForeignKey(db_column='tenant_id', on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.account')), ('account', models.ForeignKey(db_column='tenant_id', on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.tenant')),
('site', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='igny8_core_auth.site')), ('site', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='igny8_core_auth.site')),
('sector', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='igny8_core_auth.sector')), ('sector', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='igny8_core_auth.sector')),
], ],
@@ -54,7 +54,7 @@ class Migration(migrations.Migration):
('result', models.JSONField(default=dict, help_text='Execution result data')), ('result', models.JSONField(default=dict, help_text='Execution result data')),
('error_message', models.TextField(blank=True, help_text='Error message if execution failed', null=True)), ('error_message', models.TextField(blank=True, help_text='Error message if execution failed', null=True)),
('metadata', models.JSONField(default=dict, help_text='Additional metadata')), ('metadata', models.JSONField(default=dict, help_text='Additional metadata')),
('account', models.ForeignKey(db_column='tenant_id', on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.account')), ('account', models.ForeignKey(db_column='tenant_id', on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.tenant')),
('automation_rule', models.ForeignKey(help_text='The automation rule this task belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='scheduled_tasks', to='automation.automationrule')), ('automation_rule', models.ForeignKey(help_text='The automation rule this task belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='scheduled_tasks', to='automation.automationrule')),
], ],
options={ options={