# Generated by Django 5.2.6 on 2026-02-02 21:06

from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='ScheduleConfig',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('job_key', models.CharField(help_text='Unique key identifier for the job (must match the registered job name).', max_length=255, unique=True)),
                ('enabled', models.BooleanField(default=True)),
                ('trigger_type', models.CharField(choices=[('interval', 'Interval'), ('cron', 'Cron')], default='interval', max_length=20)),
                ('interval_value', models.IntegerField(blank=True, help_text='Value for interval trigger.', null=True)),
                ('interval_unit', models.CharField(blank=True, choices=[('seconds', 'Seconds'), ('minutes', 'Minutes'), ('hours', 'Hours'), ('days', 'Days'), ('weeks', 'Weeks')], default='minutes', max_length=20, null=True)),
                ('cron_minute', models.CharField(default='*', help_text='Cron minute (0-59 or *)', max_length=100)),
                ('cron_hour', models.CharField(default='*', help_text='Cron hour (0-23 or *)', max_length=100)),
                ('cron_day', models.CharField(default='*', help_text='Cron day of month (1-31 or *)', max_length=100)),
                ('cron_month', models.CharField(default='*', help_text='Cron month (1-12 or *)', max_length=100)),
                ('cron_day_of_week', models.CharField(default='*', help_text='Cron day of week (0-6 or mon,tue... or *)', max_length=100)),
                ('max_instances', models.IntegerField(default=1, help_text='Maximum number of concurrently running instances allowed.')),
                ('coalesce', models.BooleanField(default=True, help_text='Combine missed runs into one.')),
                ('misfire_grace_time', models.IntegerField(default=60, help_text='Seconds after the designated run time that the job is still allowed to run.')),
                ('log_policy', models.CharField(choices=[('none', 'None'), ('failures', 'Failures Only'), ('all', 'All Executions')], default='failures', max_length=20)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='JobExecutionLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('job_key', models.CharField(db_index=True, max_length=255)),
                ('run_time', models.DateTimeField(auto_now_add=True)),
                ('status', models.CharField(choices=[('success', 'Success'), ('fail', 'Fail')], max_length=10)),
                ('duration_ms', models.FloatField(help_text='Execution duration in milliseconds')),
                ('exception_type', models.CharField(blank=True, max_length=255, null=True)),
                ('exception_message', models.TextField(blank=True, null=True)),
                ('traceback', models.TextField(blank=True, null=True)),
                ('hostname', models.CharField(blank=True, max_length=255, null=True)),
                ('pid', models.IntegerField(blank=True, null=True)),
            ],
            options={
                'ordering': ['-run_time'],
                'indexes': [models.Index(fields=['job_key', 'status'], name='zenpulse_sc_job_key_c7a31a_idx'), models.Index(fields=['run_time'], name='zenpulse_sc_run_tim_b5c23a_idx')],
            },
        ),
    ]
