8f811db7c8
* add new primary_key field. * Add new field, populate data, change to being pk, change name, double length of name field, and set it to unique * change version, and add new migration * bump down the size, 767/4 = 191 * update readme * remove models.py comment
24 lines
575 B
Python
24 lines
575 B
Python
# -*- coding: utf-8 -*-
|
|
# Generated by Django 1.10.4 on 2017-02-06 19:45
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import migrations
|
|
|
|
def _fix_pk(apps, schema_editor):
|
|
""" Set the primary_key to be a series """
|
|
DBFile = apps.get_model("dbfilestorage", "DBFile")
|
|
for idx, dbf in enumerate(DBFile.objects.all()):
|
|
dbf.primary_key = idx+1
|
|
dbf.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('dbfilestorage', '0007_auto_20170206_1940'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(_fix_pk)
|
|
]
|