Commit 4f58d14a authored by Michal Čihař's avatar Michal Čihař

Migrate data to new IndexUpdate models

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 82d2c9e4
......@@ -15,7 +15,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='indexupdate',
name='unitid',
field=models.IntegerField(default=0, unique=True),
field=models.IntegerField(default=0, unique=False),
preserve_default=False,
),
migrations.AlterField(
......
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-02 12:21
from __future__ import unicode_literals
from django.db import migrations
def fill_in_unitid(apps, schema_editor):
IndexUpdate = apps.get_model('trans', 'IndexUpdate')
for update in IndexUpdate.objects.all():
update.unitid = update.unit_id
update.save()
class Migration(migrations.Migration):
dependencies = [
('trans', '0054_auto_20160202_1219'),
]
operations = [
migrations.RunPython(
fill_in_unitid,
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-02 12:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('trans', '0055_auto_20160202_1221'),
]
operations = [
migrations.RemoveField(
model_name='indexupdate',
name='unit',
),
migrations.AlterField(
model_name='indexupdate',
name='unitid',
field=models.IntegerField(unique=True),
),
]
......@@ -24,7 +24,6 @@ from django.utils.encoding import force_text, python_2_unicode_compatible
@python_2_unicode_compatible
class IndexUpdate(models.Model):
unit = models.OneToOneField('Unit')
unitid = models.IntegerField(unique=True)
source = models.BooleanField(default=True)
to_delete = models.BooleanField(default=False)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment