[reports] New migration does not complete

Following the discussions, I see we have implemented a proper way to handle plotter/parameters by locking them through the Report object via a relationship.

With that change, came a migration that will not work if the plotter/parameter does not exist anymore:

  Applying reports.0005_report_add_referenced_plotter_plotterparameter...Traceback (most recent call last):
  File "./bin/django", line 52, in <module>
    sys.exit(djangorecipe.binscripts.manage('beat.web.settings.settings'))
  File "/Users/andre/Projects/beat/beat.web/eggs/djangorecipe-2.1.2-py2.7.egg/djangorecipe/binscripts.py", line 9, in manage
    management.execute_from_command_line(sys.argv)
  File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/core/management/commands/migrate.py", line 222, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/db/migrations/executor.py", line 110, in migrate
    self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial)
  File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/db/migrations/executor.py", line 148, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/db/migrations/migration.py", line 115, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/db/migrations/operations/special.py", line 183, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/Users/andre/Projects/beat/beat.web/beat/web/reports/migrations/0005_report_add_referenced_plotter_plotterparameter.py", line 25, in add_plotter_references
    plotterparameter = PlotterParameter.objects.get(author__username = plotterparameters_parts[0], name = plotterparameters_parts[1], version = plotterparameters_parts[2])
  File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/db/models/manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/db/models/query.py", line 334, in get
    self.model._meta.object_name
__fake__.DoesNotExist: PlotterParameter matching query does not exist.

We must figure out:

  1. What are the affected reports
  2. What to do with those

@flavio.tarsetti: Could you please prepare a small python script that dumps report name and the names of plotters/parameters that do not exist, run it and come for the meeting with a list?