示例#1
0
class Migration(migrations.Migration):
    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("auth", "0011_update_proxy_permissions"),
        ("workstation_configs", "0001_squashed_0008_auto_20201001_0758"),
    ]

    operations = [
        migrations.CreateModel(
            name="Workstation",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("created", models.DateTimeField(auto_now_add=True)),
                ("modified", models.DateTimeField(auto_now=True)),
                (
                    "title",
                    models.CharField(max_length=255, verbose_name="title"),
                ),
                (
                    "description",
                    models.TextField(blank=True,
                                     null=True,
                                     verbose_name="description"),
                ),
                (
                    "slug",
                    django_extensions.db.fields.AutoSlugField(
                        blank=True,
                        editable=False,
                        populate_from="title",
                        verbose_name="slug",
                    ),
                ),
                (
                    "logo",
                    models.ImageField(
                        storage=grandchallenge.core.storage.PublicS3Storage(),
                        upload_to=grandchallenge.core.storage.get_logo_path,
                    ),
                ),
                (
                    "editors_group",
                    models.OneToOneField(
                        editable=False,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="editors_of_workstation",
                        to="auth.group",
                    ),
                ),
                (
                    "users_group",
                    models.OneToOneField(
                        editable=False,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="users_of_workstation",
                        to="auth.group",
                    ),
                ),
                (
                    "config",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="workstation_configs.workstationconfig",
                    ),
                ),
                (
                    "public",
                    models.BooleanField(
                        default=False,
                        help_text=
                        "If True, all logged in users can use this workstation, otherwise, only the users group can use this workstation.",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "ordering": ("created", "title")
            },
        ),
        migrations.CreateModel(
            name="WorkstationImage",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("created", models.DateTimeField(auto_now_add=True)),
                ("modified", models.DateTimeField(auto_now=True)),
                (
                    "staged_image_uuid",
                    models.UUIDField(blank=True, editable=False, null=True),
                ),
                (
                    "image",
                    models.FileField(
                        blank=True,
                        help_text=
                        ".tar.xz archive of the container image produced from the command 'docker save IMAGE | xz -c > IMAGE.tar.xz'. See https://docs.docker.com/engine/reference/commandline/save/",
                        storage=grandchallenge.core.storage.PrivateS3Storage(),
                        upload_to=grandchallenge.components.models.
                        docker_image_path,
                        validators=[
                            grandchallenge.core.validators.ExtensionValidator(
                                allowed_extensions=(
                                    ".tar",
                                    ".tar.gz",
                                    ".tar.xz",
                                ))
                        ],
                    ),
                ),
                (
                    "image_sha256",
                    models.CharField(editable=False, max_length=71),
                ),
                (
                    "ready",
                    models.BooleanField(
                        default=False,
                        editable=False,
                        help_text="Is this image ready to be used?",
                    ),
                ),
                ("status", models.TextField(editable=False)),
                ("requires_gpu", models.BooleanField(default=False)),
                (
                    "requires_gpu_memory_gb",
                    models.PositiveIntegerField(default=4),
                ),
                ("requires_memory_gb", models.PositiveIntegerField(default=4)),
                (
                    "requires_cpu_cores",
                    models.DecimalField(decimal_places=2,
                                        default=Decimal("1.0"),
                                        max_digits=4),
                ),
                (
                    "http_port",
                    models.PositiveIntegerField(
                        default=8080,
                        validators=[
                            django.core.validators.MaxValueValidator(65535)
                        ],
                    ),
                ),
                (
                    "websocket_port",
                    models.PositiveIntegerField(
                        default=4114,
                        validators=[
                            django.core.validators.MaxValueValidator(65535)
                        ],
                    ),
                ),
                (
                    "initial_path",
                    models.CharField(
                        default="cirrus",
                        max_length=256,
                        validators=[
                            django.core.validators.RegexValidator(
                                message=
                                "This path is invalid, it must not start with a /",
                                regex="^(?:[^/][^\\s]*)\\Z",
                            )
                        ],
                    ),
                ),
                (
                    "creator",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "workstation",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="workstations.workstation",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "ordering": ("created", "creator")
            },
        ),
        migrations.CreateModel(
            name="HistoricalSession",
            fields=[
                (
                    "id",
                    models.UUIDField(db_index=True,
                                     default=uuid.uuid4,
                                     editable=False),
                ),
                ("created", models.DateTimeField(blank=True, editable=False)),
                ("modified", models.DateTimeField(blank=True, editable=False)),
                (
                    "status",
                    models.PositiveSmallIntegerField(
                        choices=[
                            (0, "Queued"),
                            (1, "Started"),
                            (2, "Running"),
                            (3, "Failed"),
                            (4, "Stopped"),
                        ],
                        default=0,
                    ),
                ),
                (
                    "maximum_duration",
                    models.DurationField(default=datetime.timedelta(
                        seconds=600)),
                ),
                ("user_finished", models.BooleanField(default=False)),
                (
                    "history_id",
                    models.AutoField(primary_key=True, serialize=False),
                ),
                ("history_date", models.DateTimeField()),
                (
                    "history_change_reason",
                    models.CharField(max_length=100, null=True),
                ),
                (
                    "history_type",
                    models.CharField(
                        choices=[
                            ("+", "Created"),
                            ("~", "Changed"),
                            ("-", "Deleted"),
                        ],
                        max_length=1,
                    ),
                ),
                (
                    "creator",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "workstation_image",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="workstations.workstationimage",
                    ),
                ),
                (
                    "region",
                    models.CharField(
                        choices=[
                            ("af-south-1", "Africa (Cape Town)"),
                            ("ap-east-1", "Asia Pacific (Hong Kong)"),
                            ("ap-northeast-1", "Asia Pacific (Tokyo)"),
                            ("ap-northeast-2", "Asia Pacific (Seoul)"),
                            ("ap-northeast-3", "Asia Pacific (Osaka-Local)"),
                            ("ap-south-1", "Asia Pacific (Mumbai)"),
                            ("ap-southeast-1", "Asia Pacific (Singapore)"),
                            ("ap-southeast-2", "Asia Pacific (Sydney)"),
                            ("ca-central-1", "Canada (Central)"),
                            ("eu-central-1", "Europe (Frankfurt)"),
                            ("eu-north-1", "Europe (Stockholm)"),
                            ("eu-south-1", "Europe (Milan)"),
                            ("eu-west-1", "Europe (Ireland)"),
                            ("eu-west-2", "Europe (London)"),
                            ("eu-west-3", "Europe (Paris)"),
                            ("me-south-1", "Middle East (Bahrain)"),
                            ("sa-east-1", "South America (São Paulo)"),
                            ("us-east-1", "US East (N. Virginia)"),
                            ("us-east-2", "US East (Ohio)"),
                            ("us-west-1", "US West (N. California)"),
                            ("us-west-2", "US West (Oregon)"),
                            ("eu-nl-1", "Netherlands (Nijmegen)"),
                            ("eu-nl-2", "Netherlands (Amsterdam)"),
                        ],
                        default="eu-nl-1",
                        help_text="Which region is this session available in?",
                        max_length=14,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical session",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="Session",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("created", models.DateTimeField(auto_now_add=True)),
                ("modified", models.DateTimeField(auto_now=True)),
                (
                    "status",
                    models.PositiveSmallIntegerField(
                        choices=[
                            (0, "Queued"),
                            (1, "Started"),
                            (2, "Running"),
                            (3, "Failed"),
                            (4, "Stopped"),
                        ],
                        default=0,
                    ),
                ),
                (
                    "maximum_duration",
                    models.DurationField(default=datetime.timedelta(
                        seconds=600)),
                ),
                ("user_finished", models.BooleanField(default=False)),
                (
                    "creator",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "workstation_image",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="workstations.workstationimage",
                    ),
                ),
                ("logs", models.TextField(blank=True, editable=False)),
                (
                    "region",
                    models.CharField(
                        choices=[
                            ("af-south-1", "Africa (Cape Town)"),
                            ("ap-east-1", "Asia Pacific (Hong Kong)"),
                            ("ap-northeast-1", "Asia Pacific (Tokyo)"),
                            ("ap-northeast-2", "Asia Pacific (Seoul)"),
                            ("ap-northeast-3", "Asia Pacific (Osaka-Local)"),
                            ("ap-south-1", "Asia Pacific (Mumbai)"),
                            ("ap-southeast-1", "Asia Pacific (Singapore)"),
                            ("ap-southeast-2", "Asia Pacific (Sydney)"),
                            ("ca-central-1", "Canada (Central)"),
                            ("eu-central-1", "Europe (Frankfurt)"),
                            ("eu-north-1", "Europe (Stockholm)"),
                            ("eu-south-1", "Europe (Milan)"),
                            ("eu-west-1", "Europe (Ireland)"),
                            ("eu-west-2", "Europe (London)"),
                            ("eu-west-3", "Europe (Paris)"),
                            ("me-south-1", "Middle East (Bahrain)"),
                            ("sa-east-1", "South America (São Paulo)"),
                            ("us-east-1", "US East (N. Virginia)"),
                            ("us-east-2", "US East (Ohio)"),
                            ("us-west-1", "US West (N. California)"),
                            ("us-west-2", "US West (Oregon)"),
                            ("eu-nl-1", "Netherlands (Nijmegen)"),
                            ("eu-nl-2", "Netherlands (Amsterdam)"),
                        ],
                        default="eu-nl-1",
                        help_text="Which region is this session available in?",
                        max_length=14,
                    ),
                ),
                ("ping_times", models.JSONField(default=None, null=True)),
            ],
            options={
                "abstract": False,
                "ordering": ("created", "creator")
            },
        ),
    ]
示例#2
0
class Migration(migrations.Migration):

    dependencies = [("caluma_form", "0019_remove_answer_value_document")]

    operations = [
        migrations.CreateModel(
            name="HistoricalAnswer",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True,
                                     default=uuid.uuid4,
                                     editable=False),
                ),
                (
                    "value",
                    models.JSONField(blank=True, null=True),
                ),
                ("meta", models.JSONField(default=dict)),
                ("date", models.DateField(blank=True, null=True)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "document",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Document",
                    ),
                ),
                (
                    "file",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.File",
                    ),
                ),
                (
                    "question",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Question",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical answer",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalAnswerDocument",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True,
                                     default=uuid.uuid4,
                                     editable=False),
                ),
                (
                    "sort",
                    models.PositiveIntegerField(db_index=True,
                                                default=0,
                                                editable=False),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "answer",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Answer",
                    ),
                ),
                (
                    "document",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Document",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical answer document",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalDocument",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True,
                                     default=uuid.uuid4,
                                     editable=False),
                ),
                (
                    "family",
                    models.UUIDField(
                        db_index=True,
                        help_text="Family id which document belongs too."),
                ),
                ("meta", models.JSONField(default=dict)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "form",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Form",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical document",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalFile",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True,
                                     default=uuid.uuid4,
                                     editable=False),
                ),
                ("name", models.CharField(max_length=255)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical file",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalForm",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                ("slug", models.SlugField()),
                ("name",
                 localized_fields.fields.field.LocalizedField(required=[])),
                (
                    "description",
                    localized_fields.fields.field.LocalizedField(blank=True,
                                                                 null=True,
                                                                 required=[]),
                ),
                ("meta", models.JSONField(default=dict)),
                ("is_published", models.BooleanField(default=False)),
                ("is_archived", models.BooleanField(default=False)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "source",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        help_text="Reference this form has been copied from",
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Form",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical form",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalFormQuestion",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True,
                                     default=uuid.uuid4,
                                     editable=False),
                ),
                (
                    "sort",
                    models.PositiveIntegerField(db_index=True,
                                                default=0,
                                                editable=False),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "form",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Form",
                    ),
                ),
                (
                    "question",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Question",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical form question",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalOption",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                ("slug", models.SlugField()),
                ("label",
                 localized_fields.fields.field.LocalizedField(required=[])),
                ("meta", models.JSONField(default=dict)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "source",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        help_text="Reference this option has been copied from",
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Option",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical option",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalQuestion",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                ("slug", models.SlugField()),
                ("label",
                 localized_fields.fields.field.LocalizedField(required=[])),
                (
                    "type",
                    models.CharField(
                        choices=[
                            ("multiple_choice", "multiple_choice"),
                            ("integer", "integer"),
                            ("float", "float"),
                            ("date", "date"),
                            ("choice", "choice"),
                            ("textarea", "textarea"),
                            ("text", "text"),
                            ("table", "table"),
                            ("form", "form"),
                            ("file", "file"),
                            ("dynamic_choice", "dynamic_choice"),
                            ("dynamic_multiple_choice",
                             "dynamic_multiple_choice"),
                            ("static", "static"),
                        ],
                        max_length=23,
                    ),
                ),
                ("is_required", models.TextField(default="false")),
                ("is_hidden", models.TextField(default="false")),
                ("is_archived", models.BooleanField(default=False)),
                (
                    "placeholder",
                    localized_fields.fields.field.LocalizedField(blank=True,
                                                                 null=True,
                                                                 required=[]),
                ),
                (
                    "info_text",
                    localized_fields.fields.field.LocalizedField(blank=True,
                                                                 null=True,
                                                                 required=[]),
                ),
                (
                    "static_content",
                    localized_fields.fields.text_field.LocalizedTextField(
                        blank=True, null=True, required=[]),
                ),
                (
                    "configuration",
                    models.JSONField(default=dict),
                ),
                ("meta", models.JSONField(default=dict)),
                (
                    "data_source",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "format_validators",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=255),
                        blank=True,
                        default=list,
                        size=None,
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "row_form",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        help_text=
                        "Form that represents rows of a TableQuestion",
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Form",
                    ),
                ),
                (
                    "source",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        help_text=
                        "Reference this question has been copied from",
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Question",
                    ),
                ),
                (
                    "sub_form",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        help_text="Form referenced in a FormQuestion",
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Form",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical question",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalQuestionOption",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                ("id", models.CharField(db_index=True, max_length=255)),
                (
                    "sort",
                    models.PositiveIntegerField(db_index=True,
                                                default=0,
                                                editable=False),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "option",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Option",
                    ),
                ),
                (
                    "question",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Question",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical question option",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
示例#3
0
class Migration(migrations.Migration):

    dependencies = [
        (
            "caluma_form",
            "0020_historicalanswer_historicalanswerdocument_historicaldocument_historicalfile_historicalform_historica",
        ),
        ("caluma_workflow", "0011_auto_20190220_1303"),
    ]

    operations = [
        migrations.CreateModel(
            name="HistoricalCase",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True,
                                     default=uuid.uuid4,
                                     editable=False),
                ),
                (
                    "closed_at",
                    models.DateTimeField(
                        blank=True,
                        help_text=
                        "Time when case has either been canceled or completed",
                        null=True,
                    ),
                ),
                (
                    "closed_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "closed_by_group",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            (
                                "running",
                                "Case is running and work items need to be completed.",
                            ),
                            ("completed", "Case is done."),
                            ("canceled", "Case is cancelled."),
                        ],
                        db_index=True,
                        max_length=50,
                    ),
                ),
                ("meta", models.JSONField(default=dict)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "document",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Document",
                    ),
                ),
                (
                    "workflow",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_workflow.Workflow",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical case",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalFlow",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True,
                                     default=uuid.uuid4,
                                     editable=False),
                ),
                ("next", models.TextField()),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical flow",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalTask",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                ("slug", models.SlugField()),
                ("name",
                 localized_fields.fields.field.LocalizedField(required=[])),
                (
                    "description",
                    localized_fields.fields.field.LocalizedField(blank=True,
                                                                 null=True,
                                                                 required=[]),
                ),
                (
                    "type",
                    models.CharField(
                        choices=[
                            ("simple",
                             "Task which can simply be marked as completed."),
                            (
                                "complete_workflow_form",
                                "Task to complete a defined workflow form.",
                            ),
                            (
                                "complete_task_form",
                                "Task to complete a defined task form.",
                            ),
                        ],
                        max_length=50,
                    ),
                ),
                ("meta", models.JSONField(default=dict)),
                (
                    "address_groups",
                    models.TextField(
                        blank=True,
                        help_text=
                        "Group jexl returning what group(s) derived work items will be addressed to.",
                        null=True,
                    ),
                ),
                ("is_archived", models.BooleanField(default=False)),
                (
                    "lead_time",
                    models.PositiveIntegerField(
                        blank=True,
                        help_text=
                        "Time in seconds task may take to be processed.",
                        null=True,
                    ),
                ),
                (
                    "is_multiple_instance",
                    models.BooleanField(
                        default=False,
                        help_text=
                        "Allows creating multiple work items for this task using the `CreateWorkItem` mutation. If true, one work item will be created for each entry in `address_groups`.",
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "form",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Form",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical task",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalTaskFlow",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True,
                                     default=uuid.uuid4,
                                     editable=False),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "flow",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_workflow.Flow",
                    ),
                ),
                (
                    "task",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_workflow.Task",
                    ),
                ),
                (
                    "workflow",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_workflow.Workflow",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical task flow",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalWorkflow",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                ("slug", models.SlugField()),
                ("name",
                 localized_fields.fields.field.LocalizedField(required=[])),
                (
                    "description",
                    localized_fields.fields.field.LocalizedField(blank=True,
                                                                 null=True,
                                                                 required=[]),
                ),
                ("meta", models.JSONField(default=dict)),
                ("is_published", models.BooleanField(default=False)),
                ("is_archived", models.BooleanField(default=False)),
                (
                    "allow_all_forms",
                    models.BooleanField(
                        default=False,
                        help_text="Allow workflow to be started with any form",
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical workflow",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalWorkItem",
            fields=[
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("modified_at", models.DateTimeField(blank=True,
                                                     editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=150,
                                     null=True),
                ),
                ("history_user_id", models.CharField(max_length=150,
                                                     null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True,
                                     default=uuid.uuid4,
                                     editable=False),
                ),
                (
                    "closed_at",
                    models.DateTimeField(
                        blank=True,
                        help_text=
                        "Time when work item has either been canceled or completed",
                        null=True,
                    ),
                ),
                (
                    "closed_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "closed_by_group",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                ("deadline", models.DateTimeField(blank=True, null=True)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("ready", "Task is ready to be processed."),
                            ("completed", "Task is done."),
                            ("canceled", "Task is cancelled."),
                        ],
                        db_index=True,
                        max_length=50,
                    ),
                ),
                ("meta", models.JSONField(default=dict)),
                (
                    "addressed_groups",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=150),
                        default=list,
                        help_text=
                        "Offer work item to be processed by a group of users, such are not committed to process it though.",
                        size=None,
                    ),
                ),
                (
                    "assigned_users",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=150),
                        default=list,
                        help_text=
                        "Users responsible to undertake given work item.",
                        size=None,
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "case",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_workflow.Case",
                    ),
                ),
                (
                    "child_case",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        help_text="Defines case of a sub-workflow",
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_workflow.Case",
                    ),
                ),
                (
                    "document",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Document",
                    ),
                ),
                (
                    "task",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_workflow.Task",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical work item",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
示例#4
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="AnalyticsTable",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
                ("modified_at", models.DateTimeField(auto_now=True, db_index=True)),
                (
                    "created_by_user",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "modified_by_user",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "modified_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "slug",
                    models.SlugField(max_length=127, primary_key=True, serialize=False),
                ),
                ("meta", models.JSONField(default=dict)),
                ("disable_visibilities", models.BooleanField(default=False)),
                ("name", localized_fields.fields.field.LocalizedField(required=[])),
                (
                    "starting_object",
                    models.CharField(choices=[("cases", "Cases")], max_length=250),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="HistoricalAnalyticsTable",
            fields=[
                ("history_user_id", models.CharField(max_length=150, null=True)),
                (
                    "created_at",
                    models.DateTimeField(blank=True, db_index=True, editable=False),
                ),
                (
                    "modified_at",
                    models.DateTimeField(blank=True, db_index=True, editable=False),
                ),
                (
                    "created_by_user",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "modified_by_user",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "modified_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                ("slug", models.SlugField(max_length=127)),
                ("meta", models.JSONField(default=dict)),
                ("disable_visibilities", models.BooleanField(default=False)),
                ("name", localized_fields.fields.field.LocalizedField(required=[])),
                (
                    "starting_object",
                    models.CharField(choices=[("cases", "Cases")], max_length=250),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical analytics table",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalAnalyticsField",
            fields=[
                ("history_user_id", models.CharField(max_length=150, null=True)),
                (
                    "created_at",
                    models.DateTimeField(blank=True, db_index=True, editable=False),
                ),
                (
                    "modified_at",
                    models.DateTimeField(blank=True, db_index=True, editable=False),
                ),
                (
                    "created_by_user",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "modified_by_user",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "modified_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "id",
                    models.UUIDField(db_index=True, default=uuid.uuid4, editable=False),
                ),
                ("alias", models.CharField(max_length=100)),
                ("meta", models.JSONField(default=dict)),
                ("data_source", models.TextField()),
                (
                    "filters",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.TextField(),
                        blank=True,
                        default=list,
                        null=True,
                        size=None,
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "table",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_analytics.analyticstable",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical analytics field",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="AnalyticsField",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
                ("modified_at", models.DateTimeField(auto_now=True, db_index=True)),
                (
                    "created_by_user",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "modified_by_user",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "modified_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("alias", models.CharField(max_length=100)),
                ("meta", models.JSONField(default=dict)),
                ("data_source", models.TextField()),
                (
                    "filters",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.TextField(),
                        blank=True,
                        default=list,
                        null=True,
                        size=None,
                    ),
                ),
                (
                    "table",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="fields",
                        to="caluma_analytics.analyticstable",
                    ),
                ),
            ],
        ),
        migrations.AddConstraint(
            model_name="analyticsfield",
            constraint=models.UniqueConstraint(
                fields=("table", "data_source"), name="unique_data_source"
            ),
        ),
        migrations.AddConstraint(
            model_name="analyticsfield",
            constraint=models.UniqueConstraint(
                fields=("table", "alias"), name="unique_alias"
            ),
        ),
    ]