Skip to content

Commit cfa1ef9

Browse files
committed
Squash stats migrations
1 parent 9396b09 commit cfa1ef9

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
from django.db import migrations, models
2+
import django.db.models.deletion
3+
import django.db.models.expressions
4+
import django_extensions.db.fields
5+
6+
7+
class Migration(migrations.Migration):
8+
replaces = [
9+
('stats', '0001_initial'),
10+
('stats', '0002_imagedownload'),
11+
('stats', '0003_auto_20220306_0902'),
12+
('stats', '0004_id_big_auto_field'),
13+
('stats', '0005_imagedownload_user_agent'),
14+
]
15+
16+
initial = True
17+
18+
dependencies = [
19+
('core', '0002_merge_default_site'),
20+
]
21+
22+
operations = [
23+
migrations.CreateModel(
24+
name='GaMetrics',
25+
fields=[
26+
(
27+
'id',
28+
models.BigAutoField(
29+
auto_created=True, primary_key=True, serialize=False, verbose_name='ID'
30+
),
31+
),
32+
(
33+
'created',
34+
django_extensions.db.fields.CreationDateTimeField(
35+
auto_now_add=True, verbose_name='created'
36+
),
37+
),
38+
(
39+
'modified',
40+
django_extensions.db.fields.ModificationDateTimeField(
41+
auto_now=True, verbose_name='modified'
42+
),
43+
),
44+
('range_start', models.DateTimeField()),
45+
('range_end', models.DateTimeField()),
46+
('num_sessions', models.PositiveIntegerField()),
47+
('sessions_per_country', models.JSONField()),
48+
],
49+
options={
50+
'get_latest_by': 'modified',
51+
'abstract': False,
52+
},
53+
),
54+
migrations.CreateModel(
55+
name='ImageDownload',
56+
fields=[
57+
(
58+
'id',
59+
models.BigAutoField(
60+
auto_created=True, primary_key=True, serialize=False, verbose_name='ID'
61+
),
62+
),
63+
(
64+
'modified',
65+
django_extensions.db.fields.ModificationDateTimeField(
66+
auto_now=True, verbose_name='modified'
67+
),
68+
),
69+
(
70+
'created',
71+
django_extensions.db.fields.CreationDateTimeField(
72+
auto_now_add=True, db_index=True
73+
),
74+
),
75+
('download_time', models.DateTimeField()),
76+
('ip_address', models.GenericIPAddressField()),
77+
('user_agent', models.CharField(max_length=200, null=True)),
78+
('request_id', models.CharField(max_length=200, unique=True)),
79+
(
80+
'image',
81+
models.ForeignKey(
82+
on_delete=django.db.models.deletion.PROTECT,
83+
related_name='downloads',
84+
to='core.image',
85+
),
86+
),
87+
],
88+
options={
89+
'get_latest_by': 'modified',
90+
'abstract': False,
91+
},
92+
),
93+
migrations.AddConstraint(
94+
model_name='gametrics',
95+
constraint=models.CheckConstraint(
96+
check=models.Q(('range_start__lt', django.db.models.expressions.F('range_end'))),
97+
name='range_end_gt_range_start',
98+
),
99+
),
100+
migrations.AddConstraint(
101+
model_name='imagedownload',
102+
constraint=models.CheckConstraint(
103+
check=models.Q(('download_time__lt', django.db.models.expressions.F('created'))),
104+
name='download_occurred_before_tracking',
105+
),
106+
),
107+
]

0 commit comments

Comments
 (0)