Skip to content
Snippets Groups Projects
Commit f7f9d0bd authored by André Anjos's avatar André Anjos :speech_balloon: Committed by André Anjos
Browse files

Revert most ordering changes in 1.1.5rc's, Restore patched dumpdata

parent 489dae69
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-07-04 11:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('algorithms', '0003_auto_20160701_1707'),
]
operations = [
migrations.AlterModelOptions(
name='algorithm',
options={'ordering': ['author__username', 'name', 'version']},
),
]
...@@ -381,9 +381,7 @@ class Versionable(Shareable): ...@@ -381,9 +381,7 @@ class Versionable(Shareable):
class Meta(Shareable.Meta): class Meta(Shareable.Meta):
abstract = True abstract = True
ordering = ['name', '-version']
# setup ordering so that the dump order respects self dependencies
ordering = ['version', 'id']
#_____ Static Methods __________ #_____ Static Methods __________
...@@ -554,6 +552,7 @@ class Contribution(Versionable): ...@@ -554,6 +552,7 @@ class Contribution(Versionable):
class Meta(Versionable.Meta): class Meta(Versionable.Meta):
abstract = True abstract = True
ordering = ['author__username', 'name', 'version']
unique_together = ('author', 'name', 'version') unique_together = ('author', 'name', 'version')
......
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-07-04 11:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('databases', '0004_auto_20160701_1707'),
]
operations = [
migrations.AlterModelOptions(
name='database',
options={'ordering': ['name', '-version']},
),
]
...@@ -192,11 +192,6 @@ class Database(Versionable): ...@@ -192,11 +192,6 @@ class Database(Versionable):
class Meta(Versionable.Meta): class Meta(Versionable.Meta):
unique_together = ('name', 'version') unique_together = ('name', 'version')
# setup ordering so that the dump order respects self dependencies
# note: Versionable already has the right ordering - not sure why
# `django makemigrations' is not detecting it though.
ordering = ['version', 'id']
#_____ Utilities __________ #_____ Utilities __________
......
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-07-04 11:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('dataformats', '0002_auto_20160701_1712'),
]
operations = [
migrations.AlterModelOptions(
name='dataformat',
options={'ordering': ['author__username', 'name', 'version'], 'verbose_name': 'dataformat', 'verbose_name_plural': 'dataformats'},
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-07-04 11:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('libraries', '0003_auto_20160701_1707'),
]
operations = [
migrations.AlterModelOptions(
name='library',
options={'ordering': ['author__username', 'name', 'version'], 'verbose_name_plural': 'libraries'},
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-07-04 11:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('plotters', '0003_auto_20160701_1707'),
]
operations = [
migrations.AlterModelOptions(
name='plotter',
options={'ordering': ['author__username', 'name', 'version']},
),
migrations.AlterModelOptions(
name='plotterparameter',
options={'ordering': ['author__username', 'name', 'version']},
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-07-04 11:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('toolchains', '0003_auto_20160701_1707'),
]
operations = [
migrations.AlterModelOptions(
name='toolchain',
options={'ordering': ['author__username', 'name', 'version']},
),
]
...@@ -149,7 +149,7 @@ class Command(BaseCommand): ...@@ -149,7 +149,7 @@ class Command(BaseCommand):
destfile = os.path.join(tmpdir, 'initial.json') destfile = os.path.join(tmpdir, 'initial.json')
logger.info("Dumping initial (unspecified) data -> `%s'", destfile) logger.info("Dumping initial (unspecified) data -> `%s'", destfile)
arguments['output'] = destfile #new in Django-1.8.x arguments['output'] = destfile #new in Django-1.8.x
call_command('beatdump', **arguments) call_command('xdumpdata', **arguments)
# and backs-up the apps respecting the imposed order # and backs-up the apps respecting the imposed order
for app in use_apps: for app in use_apps:
...@@ -159,7 +159,7 @@ class Command(BaseCommand): ...@@ -159,7 +159,7 @@ class Command(BaseCommand):
logger.info("Dumping data for `%s' -> `%s'", app, destfile) logger.info("Dumping data for `%s' -> `%s'", app, destfile)
arguments['output'] = destfile #new in Django-1.8.x arguments['output'] = destfile #new in Django-1.8.x
call_command('beatdump', only.get(app, app), **arguments) call_command('xdumpdata', only.get(app, app), **arguments)
# copy prefix data # copy prefix data
path = os.path.join(settings.PREFIX, app) path = os.path.join(settings.PREFIX, app)
......
...@@ -150,14 +150,19 @@ class Command(BaseCommand): ...@@ -150,14 +150,19 @@ class Command(BaseCommand):
else: else:
objects = model._default_manager objects = model._default_manager
# BEAT PATCH: let default order take place # ###################################################
# patch for BEAT starts here: respect self ordering
# ###################################################
queryset = objects.using(using) queryset = objects.using(using)
# ORIGINAL LINE
#queryset = objects.using(using).order_by(model._meta.pk.name)
if primary_keys: if primary_keys:
queryset = queryset.filter(pk__in=primary_keys) # in case the user specifies PKs, respect order
if count_only: for pk in [int(k) for k in primary_keys]:
yield queryset.get(pk=pk)
elif count_only:
# ###################################################
# patch for BEAT ends here
# ###################################################
yield queryset.order_by().count() yield queryset.order_by().count()
else: else:
for obj in queryset.iterator(): for obj in queryset.iterator():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment