Remove obsolete migration files and update initial migration timestamps for various modules; ensure consistency in migration history across the project.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# Generated by Django 5.2.8 on 2025-11-07 10:37
|
||||
# Generated by Django 5.2.8 on 2025-11-20 23:27
|
||||
|
||||
import django.core.validators
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
@@ -10,7 +9,6 @@ class Migration(migrations.Migration):
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('igny8_core_auth', '0008_passwordresettoken_alter_industry_options_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
@@ -25,12 +23,10 @@ class Migration(migrations.Migration):
|
||||
('description', models.CharField(max_length=255)),
|
||||
('metadata', models.JSONField(default=dict, help_text='Additional context (AI call details, etc.)')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('tenant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.tenant')),
|
||||
],
|
||||
options={
|
||||
'db_table': 'igny8_credit_transactions',
|
||||
'ordering': ['-created_at'],
|
||||
'indexes': [models.Index(fields=['tenant', 'transaction_type'], name='igny8_credi_tenant__c4281c_idx'), models.Index(fields=['tenant', 'created_at'], name='igny8_credi_tenant__69abd3_idx')],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
@@ -38,7 +34,7 @@ class Migration(migrations.Migration):
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('operation_type', models.CharField(choices=[('clustering', 'Keyword Clustering'), ('ideas', 'Content Ideas Generation'), ('content', 'Content Generation'), ('images', 'Image Generation'), ('reparse', 'Content Reparse')], db_index=True, max_length=50)),
|
||||
('operation_type', models.CharField(choices=[('clustering', 'Keyword Clustering'), ('idea_generation', 'Content Ideas Generation'), ('content_generation', 'Content Generation'), ('image_generation', 'Image Generation'), ('reparse', 'Content Reparse'), ('ideas', 'Content Ideas Generation'), ('content', 'Content Generation'), ('images', 'Image Generation')], db_index=True, max_length=50)),
|
||||
('credits_used', models.IntegerField(validators=[django.core.validators.MinValueValidator(0)])),
|
||||
('cost_usd', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True)),
|
||||
('model_used', models.CharField(blank=True, max_length=100)),
|
||||
@@ -48,12 +44,10 @@ class Migration(migrations.Migration):
|
||||
('related_object_id', models.IntegerField(blank=True, null=True)),
|
||||
('metadata', models.JSONField(default=dict)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('tenant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.tenant')),
|
||||
],
|
||||
options={
|
||||
'db_table': 'igny8_credit_usage_logs',
|
||||
'ordering': ['-created_at'],
|
||||
'indexes': [models.Index(fields=['tenant', 'operation_type'], name='igny8_credi_tenant__3545ed_idx'), models.Index(fields=['tenant', 'created_at'], name='igny8_credi_tenant__4aee99_idx'), models.Index(fields=['tenant', 'operation_type', 'created_at'], name='igny8_credi_tenant__a00d57_idx')],
|
||||
},
|
||||
),
|
||||
]
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# Generated by Django 5.2.8 on 2025-11-20 23:27
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('billing', '0001_initial'),
|
||||
('igny8_core_auth', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='credittransaction',
|
||||
name='account',
|
||||
field=models.ForeignKey(db_column='tenant_id', on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.account'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='creditusagelog',
|
||||
name='account',
|
||||
field=models.ForeignKey(db_column='tenant_id', on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.account'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='credittransaction',
|
||||
index=models.Index(fields=['account', 'transaction_type'], name='igny8_credi_tenant__c4281c_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='credittransaction',
|
||||
index=models.Index(fields=['account', 'created_at'], name='igny8_credi_tenant__69abd3_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='creditusagelog',
|
||||
index=models.Index(fields=['account', 'operation_type'], name='igny8_credi_tenant__3545ed_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='creditusagelog',
|
||||
index=models.Index(fields=['account', 'created_at'], name='igny8_credi_tenant__4aee99_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='creditusagelog',
|
||||
index=models.Index(fields=['account', 'operation_type', 'created_at'], name='igny8_credi_tenant__a00d57_idx'),
|
||||
),
|
||||
]
|
||||
@@ -1,23 +0,0 @@
|
||||
# Generated migration to rename tenant field to account
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('billing', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='credittransaction',
|
||||
old_name='tenant',
|
||||
new_name='account',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='creditusagelog',
|
||||
old_name='tenant',
|
||||
new_name='account',
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
# Generated migration to fix tenant_id column name
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('billing', '0002_rename_tenant_to_account'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# Rename the database column from account_id to tenant_id to match model's db_column
|
||||
migrations.RunSQL(
|
||||
sql="ALTER TABLE igny8_credit_transactions RENAME COLUMN account_id TO tenant_id;",
|
||||
reverse_sql="ALTER TABLE igny8_credit_transactions RENAME COLUMN tenant_id TO account_id;"
|
||||
),
|
||||
migrations.RunSQL(
|
||||
sql="ALTER TABLE igny8_credit_usage_logs RENAME COLUMN account_id TO tenant_id;",
|
||||
reverse_sql="ALTER TABLE igny8_credit_usage_logs RENAME COLUMN tenant_id TO account_id;"
|
||||
),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user