class Migration(migrations.Migration):

    dependencies = [
        ('phonelog', '0010_rename_device_model'),
    ]

    operations = [
        migrations.CreateModel(
            name='DeviceReportEntry',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('xform_id', models.CharField(db_index=True, max_length=50)),
                ('i', models.IntegerField()),
                ('msg', models.TextField()),
                ('type', models.CharField(max_length=32)),
                ('date', models.DateTimeField()),
                ('server_date', models.DateTimeField(db_index=True,
                                                     null=True)),
                ('domain', models.CharField(max_length=100)),
                ('device_id', models.CharField(max_length=50, null=True)),
                ('app_version', models.TextField(null=True)),
                ('username', models.CharField(max_length=100, null=True)),
                ('user_id', models.CharField(max_length=50, null=True)),
            ],
            options={
                'db_table': 'phonelog_daily_partitioned_devicereportentry',
            },
        ),
        migrations.AlterUniqueTogether(
            name='devicereportentry',
            unique_together=set([('xform_id', 'i')]),
        ),
        migrations.AlterIndexTogether(
            name='devicereportentry',
            index_together=set([('domain', 'device_id'), ('domain', 'date'),
                                ('domain', 'type'), ('domain', 'username')]),
        ),
        HqRunSQL(
            add_if_not_exists_raw(
                """
                CREATE INDEX devicereportentry_domain_device_id_pattern_ops
                ON phonelog_daily_partitioned_devicereportentry (domain, device_id varchar_pattern_ops)
                """,
                name=
                'phonelog_daily_partitioned_devicereportentry_domain_device_id_pattern_ops'
            ),
            reverse_sql="""
            DROP INDEX IF EXISTS devicereportentry_domain_device_id_pattern_ops
            """,
        ),
        HqRunPython(add_partitions),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('accounting', '0005_automatic_downgrade_adjustment_method'),
    ]

    operations = [
        migrations.RunSQL(
            add_if_not_exists_raw(
                """
                CREATE UNIQUE INDEX accounting_subscription_active_subscriber
                ON accounting_subscription(subscriber_id) WHERE (is_active = TRUE and is_hidden_to_ops = FALSE)
                """,
                name='accounting_subscription_active_subscriber'),
            reverse_sql="""
            DROP INDEX IF EXISTS accounting_subscription_active_subscriber;
            """,
        )
    ]
Ejemplo n.º 3
0
class Migration(migrations.Migration):

    dependencies = [
        ('userreports', '0006_add_index_to_domain'),
    ]

    operations = [
        HqRunSQL(
            add_if_not_exists_raw(
                """
                CREATE INDEX userreports_asyncindicator_indicator_config_ids_gin_idx
                ON userreports_asyncindicator USING GIN (indicator_config_ids)
                """,
                name='userreports_asyncindicator_indicator_config_ids_gin_idx'
            ),
            reverse_sql="""
            DROP INDEX IF EXISTS userreports_asyncindicator_indicator_config_ids_gin_idx
            """,
        ),
    ]
Ejemplo n.º 4
0
class Migration(migrations.Migration):

    dependencies = [
        ('phonelog', '0007_devicelog_indexes'),
    ]

    operations = [
        HqRunSQL(
            add_if_not_exists_raw(
                """
                CREATE INDEX phonelog_devicereportentry_domain_device_id_pattern_ops
                ON phonelog_devicereportentry (domain varchar_pattern_ops, device_id varchar_pattern_ops)
                """,
                name='phonelog_devicereportentry_domain_device_id_pattern_ops'
            ),
            reverse_sql="""
            DROP INDEX IF EXISTS phonelog_devicereportentry_domain_device_id_pattern_ops
            """,
        )
    ]