Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeNotFoundError Migration error(Python 3) #30

Closed
psychok7 opened this issue Oct 13, 2016 · 8 comments
Closed

NodeNotFoundError Migration error(Python 3) #30

psychok7 opened this issue Oct 13, 2016 · 8 comments
Assignees

Comments

@psychok7
Copy link
Contributor

Hi, i am trying django-river 0.8.2 + Django=1.10 and i am running into a migration error.

my model is:

class QualificationRequest(models.Model):
    rnal_code = models.CharField(max_length=50, null=True, blank=True)
    name = models.CharField(max_length=200)
    phone = models.CharField(max_length=50)
    email = models.EmailField()

    status = StateField(editable=False)

    created_on = models.DateTimeField(auto_now_add=True)
    updated_on = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.name

here is the traceback:

[localhost] local: docker-compose -f dev.yml run --rm smal_task python3 manage.py makemigrations --settings=smal.settings.local
System check identified some issues:

WARNINGS:
river.ProceedingMeta.groups: (fields.W340) null has no effect on ManyToManyField.
river.ProceedingMeta.parents: (fields.W340) null has no effect on ManyToManyField.
Migrations for 'qualifications':
  qualifications/migrations/0001_initial.py:
    - Create model QualificationRequest
Migrations for 'river':
  /usr/local/lib/python3.5/dist-packages/river/migrations/0007_auto_20161013_1124.py:
    - Alter field parents on proceedingmeta
[localhost] local: docker-compose -f dev.yml run --rm smal_task python3 manage.py migrate --settings=smal.settings.local
System check identified some issues:

WARNINGS:
river.ProceedingMeta.groups: (fields.W340) null has no effect on ManyToManyField.
river.ProceedingMeta.parents: (fields.W340) null has no effect on ManyToManyField.
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/migrate.py", line 83, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/executor.py", line 20, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/loader.py", line 52, in __init__
    self.build_graph()
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/loader.py", line 268, in build_graph
    raise exc
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/loader.py", line 238, in build_graph
    self.graph.validate_consistency()
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/graph.py", line 261, in validate_consistency
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/graph.py", line 261, in <listcomp>
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/graph.py", line 104, in raise_error
    raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration qualifications.0001_initial dependencies reference nonexistent parent node ('river', '0007_auto_20161013_1124')

Any ideas??

@psychok7
Copy link
Contributor Author

@javrasya let me know if you need more information

@psychok7
Copy link
Contributor Author

psychok7 commented Oct 13, 2016

After fiddling around i think i may have found the root problem and a workaround.

so basically my 0001_initial.py was generating this

    dependencies = [
        ('river', '0007_auto_20161013_1149'),
    ]

This migration does not exist in the source code (and i am not sure were is it coming from) so i changed the migration to:

    dependencies = [
        ('river', '0006_auto_20160524_0439'),
    ]

I noticed then that there was one migration left to do (the actual 0007)

root@8b7595afac0e:/code# python3 manage.py makemigrations --settings=smal.settings.local
System check identified some issues:

WARNINGS:
river.ProceedingMeta.groups: (fields.W340) null has no effect on ManyToManyField.
river.ProceedingMeta.parents: (fields.W340) null has no effect on ManyToManyField.
Migrations for 'river':
  /usr/local/lib/python3.5/dist-packages/river/migrations/0007_auto_20161013_1150.py:
    - Alter field parents on proceedingmeta
root@8b7595afac0e:/code# python3 manage.py migrate --settings=smal.settings.local
System check identified some issues:

WARNINGS:
river.ProceedingMeta.groups: (fields.W340) null has no effect on ManyToManyField.
river.ProceedingMeta.parents: (fields.W340) null has no effect on ManyToManyField.
Operations to perform:
  Apply all migrations: admin, auth, authtoken, authtools, contenttypes, djcelery, ip_geocoding, local_accommodation, qualifications, river, sessions, sites, users
Running migrations:
  Applying river.0007_auto_20161013_1150... OK
root@8b7595afac0e:/code#

Hope this helps

@javrasya
Copy link
Owner

I think there is a problem with python 3, because here is the result with python 2.7

    dependencies = [
        ('river', '0006_auto_20160524_0439'),
    ]

I could reproduce your case with python 3. I am looking at it.

@javrasya javrasya changed the title NodeNotFoundError Migration error NodeNotFoundError Migration error(Python 3) Oct 15, 2016
@javrasya
Copy link
Owner

I create migrations with python 2.7 most of time. In a weird way, python2.7 could't detect a migration which is 0007 one somehow python3 can detect. I will create this migration with python3 and commit it.

javrasya added a commit that referenced this issue Oct 15, 2016
…blem was becuase of python2.7 because it couldn't detect this migration but python3 did.
@javrasya
Copy link
Owner

@psychok7 could you please test it with master branch, it supposed to be fixed, I commited the missing migration file.

@javrasya
Copy link
Owner

Please, do not forget to install it with --upgrade to delete previous django-river to reset migrations. Because you created 0007 in your workspace right.

@psychok7
Copy link
Contributor Author

@javrasya oh ok, i will try to test it tomorrow or monday morning and let you know

javrasya added a commit that referenced this issue Oct 16, 2016
javrasya added a commit that referenced this issue Oct 16, 2016
@psychok7
Copy link
Contributor Author

@javrasya i tested the latest commit against a database without django river but with data and everything is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants