Initial commit
This commit is contained in:
73
domains/migrations/0001_initial.py
Normal file
73
domains/migrations/0001_initial.py
Normal file
@@ -0,0 +1,73 @@
|
||||
# Generated by Django 5.2.8 on 2025-11-07 07:39
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('plans', '0001_initial'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Domain',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=253, unique=True)),
|
||||
('status', models.CharField(choices=[('pending_dns', '等待DNS配置'), ('active', '正常'), ('suspended', '暂停'), ('deleted', '已删除')], default='pending_dns', max_length=20)),
|
||||
('current_cycle_start', models.DateField(blank=True, null=True)),
|
||||
('current_cycle_end', models.DateField(blank=True, null=True)),
|
||||
('cname_targets', models.JSONField(blank=True, default=dict)),
|
||||
('origin_config', models.JSONField(blank=True, default=dict)),
|
||||
('edge_server_id', models.BigIntegerField(blank=True, null=True)),
|
||||
('extra_free_traffic_gb_current_cycle', models.PositiveIntegerField(default=0)),
|
||||
('custom_overage_price_per_gb', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
|
||||
('custom_features', models.JSONField(blank=True, default=dict)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('current_plan', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='plans.plan')),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='domains', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '域名',
|
||||
'verbose_name_plural': '域名',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DomainTrafficDaily',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('day', models.DateField()),
|
||||
('bytes', models.BigIntegerField(default=0)),
|
||||
('peak_bandwidth_mbps', models.FloatField(default=0)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('domain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='daily_traffic', to='domains.domain')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '域名日流量',
|
||||
'verbose_name_plural': '域名日流量',
|
||||
},
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='domain',
|
||||
index=models.Index(fields=['user', 'name'], name='domains_dom_user_id_840f80_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='domain',
|
||||
index=models.Index(fields=['status'], name='domains_dom_status_e71c1c_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='domaintrafficdaily',
|
||||
index=models.Index(fields=['domain', 'day'], name='domains_dom_domain__a38816_idx'),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='domaintrafficdaily',
|
||||
unique_together={('domain', 'day')},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user