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

Problems with migrations in Django 1.11 #24

Open
math-a3k opened this issue Sep 1, 2017 · 2 comments
Open

Problems with migrations in Django 1.11 #24

math-a3k opened this issue Sep 1, 2017 · 2 comments

Comments

@math-a3k
Copy link

math-a3k commented Sep 1, 2017

I'm developing a package with Django 1.11 which depends on django-dag.

There are 2 models in the app depending on dag:

class BayesianNetworkEdge(
        edge_factory('bayesian_networks.BayesianNetworkNode')):
        ....

class BayesianNetworkNode(
        node_factory('bayesian_networks.BayesianNetworkEdge')):
        ....

The problem is that on a fresh install, django_dag does not ships with the initial migration and Django creates it when another migration requiring it is created.

If I ship that migration (pointing to django_dag tables) it will fail on a fresh install because it points to a non-existent one, and the migrations have to be deleted and recreated to trigger the creation of dag tables.

Have you consider including an initial migration with those tables in order to fix this kind of problems?

@math-a3k
Copy link
Author

math-a3k commented Sep 6, 2017

@math-a3k
Copy link
Author

math-a3k commented Sep 9, 2017

This migration does the trick:
https://github.com/math-a3k/django-ai/blob/master/misc/django_dag_0001_initial.py
Though not without caveats, it will ask for a default value for the existing rows - which are none, because is an initial, so you can safely put any number.

I still can't find where the problem is exactly, if django_ai is installed as a package, Django creates the migrations "well", but inside the package it doesn't: it creates either django_dag's or the django_ai's app, pointing to each other and ending up in a circular dependency error.

The solution is copying that migration to django_dag migrations and migrate your app, that way it will go smoothly (with the "default value" caveat)

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

1 participant