# Generated by Django 5.2.9 on 2025-12-29

from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='DataSourceConfig',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='数据源名称', max_length=50, unique=True)),
                ('source_type', models.CharField(choices=[('tushare', 'Tushare Pro'), ('akshare', 'AKShare'), ('fred', 'FRED'), ('wind', 'Wind'), ('choice', 'Choice')], help_text='数据源类型', max_length=20)),
                ('is_active', models.BooleanField(default=True, help_text='是否启用')),
                ('priority', models.IntegerField(default=0, help_text='优先级（数字越小越优先）')),
                ('api_endpoint', models.URLField(blank=True, help_text='API 端点 URL')),
                ('api_key', models.CharField(blank=True, help_text='API 密钥', max_length=200)),
                ('api_secret', models.CharField(blank=True, help_text='API 密钥（如需要）', max_length=200)),
                ('extra_config', models.JSONField(blank=True, default=dict, help_text='额外配置参数')),
                ('description', models.TextField(blank=True, help_text='描述')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': '数据源配置',
                'verbose_name_plural': '数据源配置',
                'db_table': 'data_source_config',
                'ordering': ['priority', 'name'],
            },
        ),
        migrations.CreateModel(
            name='MacroIndicator',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(db_index=True, help_text='指标代码', max_length=50)),
                ('value', models.DecimalField(decimal_places=6, help_text='指标值', max_digits=20)),
                ('observed_at', models.DateField(db_index=True, help_text='指标所属期间')),
                ('published_at', models.DateField(blank=True, help_text='实际发布时间', null=True)),
                ('publication_lag_days', models.IntegerField(default=0, help_text='发布延迟天数')),
                ('source', models.CharField(help_text='数据源', max_length=20)),
                ('revision_number', models.IntegerField(default=1, help_text='修订版本号')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'macro_indicator',
                'ordering': ['-observed_at', '-revision_number'],
                'indexes': [
                    models.Index(fields=['code', '-observed_at'], name='macro_in_code_obs_idx'),
                ],
            },
        ),
    ]
