Comments (16)
Actually, scratch that, after thinking a little more about it it makes sense that you'd get an error in certain circumstances. I believe the error occurs as a result of the workflow I mentioned before, and I think the reason the newly created migration in Django Address gets deleted is due most likely to reinstalling the dependencies/virtual environment.
I'll raise a PR to correct the issue and link to this issue. Thanks @daniel-butler!
from django-address.
I honestly don't know how I got that migration number. When I looked through the current develop branch and the one tag with the version number I found the latest migration to be 0003_auto_20200830_1851
when I updated the migration to use that file it worked.
https://github.com/furious-luke/django-address/tree/develop/address/migrations
from django-address.
Hi @daniel-butler! That sounds pretty frustrating. If you were to start a new project do you still get the same error? One thing to check might be that your database is empty before trying again. Django stores details about which migrations have been run, it could be conceivable that it's getting confused by bogus data in the migration table (however that's just a guess).
Please let me know if you're still experiencing issues, we'll dig into it.
from django-address.
It happened again when I recreated the migrations. It is possible I am doing something wrong, though.
from django-address.
Could this be the issue?
https://stackoverflow.com/questions/67006488/migrating-models-of-dependencies-when-changing-default-auto-field
from django-address.
I think that is it. I'll try it tomorrow!
from django-address.
That was the issue! This was the fix
settings.py
INSTALLED_APPS = [
...
"project.apps.ModifiedAddressConfig",
...
]
project/apps.py
"""
Defines app configurations for dependency files to avoid unnecessary migrations
More details: https://stackoverflow.com/a/67007098/7838574
"""
from address.apps import AddressConfig
class ModifiedAddressConfig(AddressConfig):
default_auto_field = "django.db.models.AutoField"
from django-address.
Hey @daniel-butler! That certainly explains why you're getting an additional migration created within Django Address, however it's not clear to me that this explains why there is a non-existant parent migration file, which I think is the more pressing concern.
I've created the same situation locally (i.e. I've set DEFAULT_AUTO_FIELD to BigAutoField instead of AutoField) and can cause Django to trigger creating a new migration, however it also migrates correctly:
So, it seems that for some reason the generated migration file in your setup is getting removed. Can you think of a reason why that might be happening?
from django-address.
Yeah, I think, it is because I added Django-address after I had a few migrations in the project. When creating the new migration with addresses is when I ran into the issue of have a non-existing migration being a parent of another.
Thinking about it, I would expect to continue to run into the problem, but it only happened once.
Does that help?
from django-address.
Yeah, I think, it is because I added Django-address after I had a few migrations in the project. When creating the new migration with addresses is when I ran into the issue of have a non-existing migration being a parent of another.
That's the process I used to generate the above output I attached, so not sure if that's the cause.
The only situation I can think of that might account for the issue you were seeing is if at some point you ran makemigrations
and it generated the additional migration file in Django Address, and also added a dependency to that migration in one of your own migrations in your Django project, and then subsequent to that, that new migration file in Address was deleted. Then, the next time you ran makemigrations
that migration in Address would be created again, but with a new filename, thus causing the missing migration.
From your initial post, it looks like the missing migration name was located in project_app
, was your Django project called project
by any chance?
from django-address.
No, it's not called project. I just changed the name to that.
Do you have a link you could share for the project that generated the migrations above? I'm missing the part where there are migrations in the project before address is added to the project.
I am also using django-tenants which could be attributing to the problem because migrations are split between the public tenant and all others.
from django-address.
Do you have a link you could share for the project that generated the migrations above?
Nope, sorry, I just threw it together based on the example site in Django Address.
As an alternative, could you create a minimal example that reproduces the issue you're seeing?
from django-address.
django-address version: 0.2.6
Hello guys ! I think I am facing the same problem here.
Do you think you will raise a PR soon ? I did not really understand the problem but I also have a depedency generated like this :
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('contenttypes', '0002_remove_content_type_name'),
('address', '0004_alter_address_id_alter_country_id_alter_locality_id_and_more'),
]
I get this error when I migrate :
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin) django.db.migrations.exceptions.NodeNotFoundError: Migration idt.0001_initial dependencies reference nonexistent parent node ('address', '0004_alter_address_id_alter_country_id_alter_locality_id_and_more')
I tried the solutions explained before but none of them worked.
from django-address.
Hi @AntoineHessAcernis and @daniel-butler! My apologies for the long delay, I've just published the latest version of Django Address containing the necessary fix to this issue. Please give it a go and let me know if anything goes awry.
from django-address.
Thank you for fixing, and all the work in this project!
from django-address.
Thank you @furious-luke, it works for me.
from django-address.
Related Issues (20)
- Add end-to-end tests
- Use Docker for example site HOT 2
- Admin does not query google HOT 2
- default Autofield and django 3.2
- Update translation to Django 4 HOT 1
- Include serializers for usage inside rest framework HOT 2
- Error installing version 0.2.7 due to incorrect metadata HOT 1
- Python3.9 integration HOT 2
- Address save via admin saves the primary key into raw column, and additionally creates a bare new object HOT 3
- unique=True HOT 2
- Error when using together with Django autocomplete fields in admin HOT 3
- {{ form.media }} seems to render nothing in Django 4 HOT 2
- Address Form field only populates if full address is provided.
- Fill related models upon Address creation.
- Support for model serializer with django-rest-framework HOT 4
- Add documentation to readthedocs
- Prefer django_countries.fields.CountryField instead of implement address.models.Country
- AddressField on admin site
- Cant select address without `address_street_number`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-address.