41 lines
1.9 KiB
Python
41 lines
1.9 KiB
Python
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
from django.conf import settings
|
|
import django.utils.timezone
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('core', '0003_alter_sitesettings_blog_description_and_more'),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Visit',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('visitor_id', models.CharField(db_index=True, max_length=64)),
|
|
('date', models.DateField(db_index=True)),
|
|
('first_seen', models.DateTimeField(default=django.utils.timezone.now)),
|
|
('last_seen', models.DateTimeField(default=django.utils.timezone.now)),
|
|
('path', models.CharField(blank=True, max_length=512)),
|
|
('referrer', models.CharField(blank=True, max_length=512)),
|
|
('utm_source', models.CharField(blank=True, max_length=100)),
|
|
('utm_medium', models.CharField(blank=True, max_length=100)),
|
|
('utm_campaign', models.CharField(blank=True, max_length=150)),
|
|
('source', models.CharField(blank=True, help_text='Domaine de provenance ou utm_source', max_length=150)),
|
|
('country', models.CharField(blank=True, max_length=64)),
|
|
('became_user_at', models.DateTimeField(blank=True, null=True)),
|
|
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='visits', to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
options={
|
|
'ordering': ['-date', '-last_seen'],
|
|
},
|
|
),
|
|
migrations.AlterUniqueTogether(
|
|
name='visit',
|
|
unique_together={('visitor_id', 'date')},
|
|
),
|
|
]
|