Skip to content

Commit

Permalink
Added new migrations for indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
OdinsPlasmaRifle committed Jan 24, 2020
1 parent af6f7cb commit aeedff2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
38 changes: 38 additions & 0 deletions drf_request_logging/migrations/0002_auto_20200124_1348.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 2.2.2 on 2020-01-24 13:48

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('drf_request_logging', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='request',
name='key',
field=models.CharField(db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='request',
name='method',
field=models.CharField(db_index=True, max_length=10),
),
migrations.AlterField(
model_name='request',
name='path',
field=models.CharField(blank=True, db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='request',
name='status_code',
field=models.IntegerField(blank=True, db_index=True, null=True),
),
migrations.AlterField(
model_name='request',
name='updated',
field=models.DateTimeField(auto_now=True, db_index=True),
),
]
12 changes: 7 additions & 5 deletions drf_request_logging/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')

class Request(models.Model):
key = models.CharField(null=True, max_length=100)
key = models.CharField(db_index=True, null=True, max_length=100)
user = models.ForeignKey(
USER_MODEL,
null=True,
Expand All @@ -18,16 +18,18 @@ class Request(models.Model):
related_name='drf_requests'
)
scheme = models.CharField(max_length=5)
path = models.CharField(null=True, blank=True, max_length=100)
method = models.CharField(max_length=10)
path = models.CharField(
db_index=True, null=True, blank=True, max_length=100
)
method = models.CharField(db_index=True, max_length=10)
encoding = models.CharField(null=True, blank=True, max_length=100)
content_type = models.CharField(max_length=100)
params = JSONField(null=True, blank=True, default=dict)
headers = JSONField(null=True, blank=True, default=dict)
body = JSONField(null=True, blank=True, default=dict)
status_code = models.IntegerField(null=True, blank=True)
status_code = models.IntegerField(db_index=True, null=True, blank=True)
response = models.BinaryField(null=True, blank=True)
updated = models.DateTimeField(auto_now=True)
updated = models.DateTimeField(auto_now=True, db_index=True)
created = models.DateTimeField(auto_now_add=True, db_index=True)

class Meta:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import find_packages, setup


VERSION = '0.0.2'
VERSION = '0.0.3'

with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
Expand Down

0 comments on commit aeedff2

Please sign in to comment.