# Generated by Django 2.1.2 on 2019-04-06 03:42

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("repository", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="PackageVersionDownloadEvent",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("source_ip", models.GenericIPAddressField()),
                ("last_download", models.DateTimeField(auto_now_add=True)),
                ("total_downloads", models.PositiveIntegerField(default=1)),
                ("counted_downloads", models.PositiveIntegerField(default=1)),
                (
                    "version",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="download_events",
                        to="repository.PackageVersion",
                    ),
                ),
            ],
        ),
        migrations.AlterUniqueTogether(
            name="packageversiondownloadevent",
            unique_together={("version", "source_ip")},
        ),
    ]
