Skip to content

Commit

Permalink
Use BigInt primary keys on squashable models
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Sep 4, 2017
1 parent ac97510 commit 1c92cb2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
30 changes: 30 additions & 0 deletions casepro/statistics/migrations/0012_auto_20170904_1408.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-09-04 14:08
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('statistics', '0011_auto_20170605_0657'),
]

operations = [
migrations.AlterField(
model_name='dailycount',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
migrations.AlterField(
model_name='dailysecondtotalcount',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
migrations.AlterField(
model_name='totalcount',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
]
2 changes: 2 additions & 0 deletions casepro/statistics/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class BaseCount(models.Model):
TYPE_CASE_OPENED = 'C'
TYPE_CASE_CLOSED = 'D'

id = models.BigAutoField(auto_created=True, primary_key=True, verbose_name='ID')

squash_sql = """
WITH removed as (
DELETE FROM %(table_name)s WHERE %(delete_cond)s RETURNING "count"
Expand Down

0 comments on commit 1c92cb2

Please sign in to comment.