-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9396b09
commit cfa1ef9
Showing
1 changed file
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import django.db.models.expressions | ||
import django_extensions.db.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
replaces = [ | ||
('stats', '0001_initial'), | ||
('stats', '0002_imagedownload'), | ||
('stats', '0003_auto_20220306_0902'), | ||
('stats', '0004_id_big_auto_field'), | ||
('stats', '0005_imagedownload_user_agent'), | ||
] | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('core', '0002_merge_default_site'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='GaMetrics', | ||
fields=[ | ||
( | ||
'id', | ||
models.BigAutoField( | ||
auto_created=True, primary_key=True, serialize=False, verbose_name='ID' | ||
), | ||
), | ||
( | ||
'created', | ||
django_extensions.db.fields.CreationDateTimeField( | ||
auto_now_add=True, verbose_name='created' | ||
), | ||
), | ||
( | ||
'modified', | ||
django_extensions.db.fields.ModificationDateTimeField( | ||
auto_now=True, verbose_name='modified' | ||
), | ||
), | ||
('range_start', models.DateTimeField()), | ||
('range_end', models.DateTimeField()), | ||
('num_sessions', models.PositiveIntegerField()), | ||
('sessions_per_country', models.JSONField()), | ||
], | ||
options={ | ||
'get_latest_by': 'modified', | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='ImageDownload', | ||
fields=[ | ||
( | ||
'id', | ||
models.BigAutoField( | ||
auto_created=True, primary_key=True, serialize=False, verbose_name='ID' | ||
), | ||
), | ||
( | ||
'modified', | ||
django_extensions.db.fields.ModificationDateTimeField( | ||
auto_now=True, verbose_name='modified' | ||
), | ||
), | ||
( | ||
'created', | ||
django_extensions.db.fields.CreationDateTimeField( | ||
auto_now_add=True, db_index=True | ||
), | ||
), | ||
('download_time', models.DateTimeField()), | ||
('ip_address', models.GenericIPAddressField()), | ||
('user_agent', models.CharField(max_length=200, null=True)), | ||
('request_id', models.CharField(max_length=200, unique=True)), | ||
( | ||
'image', | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name='downloads', | ||
to='core.image', | ||
), | ||
), | ||
], | ||
options={ | ||
'get_latest_by': 'modified', | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.AddConstraint( | ||
model_name='gametrics', | ||
constraint=models.CheckConstraint( | ||
check=models.Q(('range_start__lt', django.db.models.expressions.F('range_end'))), | ||
name='range_end_gt_range_start', | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name='imagedownload', | ||
constraint=models.CheckConstraint( | ||
check=models.Q(('download_time__lt', django.db.models.expressions.F('created'))), | ||
name='download_occurred_before_tracking', | ||
), | ||
), | ||
] |