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,100 +0,0 @@
|
||||
# Generated manually for Phase 2: Automation System
|
||||
|
||||
import django.core.validators
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('igny8_core_auth', '0008_passwordresettoken_alter_industry_options_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='AutomationRule',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('name', models.CharField(help_text='Rule name', max_length=255)),
|
||||
('description', models.TextField(blank=True, help_text='Rule description', null=True)),
|
||||
('trigger', models.CharField(choices=[('schedule', 'Schedule'), ('event', 'Event'), ('manual', 'Manual')], default='manual', max_length=50)),
|
||||
('schedule', models.CharField(blank=True, help_text="Cron-like schedule string (e.g., '0 0 * * *' for daily at midnight)", max_length=100, null=True)),
|
||||
('conditions', models.JSONField(default=list, help_text='List of conditions that must be met for rule to execute')),
|
||||
('actions', models.JSONField(default=list, help_text='List of actions to execute when rule triggers')),
|
||||
('is_active', models.BooleanField(default=True, help_text='Whether rule is active')),
|
||||
('status', models.CharField(choices=[('active', 'Active'), ('inactive', 'Inactive'), ('paused', 'Paused')], default='active', max_length=50)),
|
||||
('last_executed_at', models.DateTimeField(blank=True, null=True)),
|
||||
('execution_count', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0)])),
|
||||
('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')),
|
||||
('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')),
|
||||
],
|
||||
options={
|
||||
'db_table': 'igny8_automation_rules',
|
||||
'ordering': ['-created_at'],
|
||||
'verbose_name': 'Automation Rule',
|
||||
'verbose_name_plural': 'Automation Rules',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ScheduledTask',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('scheduled_at', models.DateTimeField(help_text='When the task is scheduled to run')),
|
||||
('executed_at', models.DateTimeField(blank=True, help_text='When the task was actually executed', null=True)),
|
||||
('status', models.CharField(choices=[('pending', 'Pending'), ('running', 'Running'), ('completed', 'Completed'), ('failed', 'Failed'), ('cancelled', 'Cancelled')], default='pending', max_length=50)),
|
||||
('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)),
|
||||
('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')),
|
||||
('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={
|
||||
'db_table': 'igny8_scheduled_tasks',
|
||||
'ordering': ['-scheduled_at'],
|
||||
'verbose_name': 'Scheduled Task',
|
||||
'verbose_name_plural': 'Scheduled Tasks',
|
||||
},
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='automationrule',
|
||||
index=models.Index(fields=['trigger', 'is_active'], name='igny8_autom_trigger_123abc_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='automationrule',
|
||||
index=models.Index(fields=['status'], name='igny8_autom_status_456def_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='automationrule',
|
||||
index=models.Index(fields=['site', 'sector'], name='igny8_autom_site_id_789ghi_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='automationrule',
|
||||
index=models.Index(fields=['trigger', 'is_active', 'status'], name='igny8_autom_trigger_0abjkl_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='scheduledtask',
|
||||
index=models.Index(fields=['automation_rule', 'status'], name='igny8_sched_automation_123abc_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='scheduledtask',
|
||||
index=models.Index(fields=['scheduled_at', 'status'], name='igny8_sched_scheduled_456def_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='scheduledtask',
|
||||
index=models.Index(fields=['account', 'status'], name='igny8_sched_account_789ghi_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='scheduledtask',
|
||||
index=models.Index(fields=['status', 'scheduled_at'], name='igny8_sched_status_0abjkl_idx'),
|
||||
),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user