I am at course Django video Creating migrations. After first run the command makemigrations there were all ok but I changed the model name from price to Unit_price and entered makemigrations error says no changed detected.
What happens if you run the command:
python manage.py migrate
If nothing happens maybe you could attach som screenshots? From project.settings INSTALLED_APPS and your projectstructure (so we can see what your apps are called).
So first you ran makemigrations, made your change to the model and then makemigrations again? Did you run migrate between the makemigrations? Was this your first migration?
If so, maybe you can find some clues on where to look in this stackoverflow-post:
So first you ran makemigrations, made your change to the model and then makemigrations again?
the first makemigrations works well after chaging some models and giving makemigrations again resulting: no change. This is the main problem
I did not run migrate between makemigrations.
Was this your first migration?
I am following the course. According the course if I change price name in Products model to unit_price makemigrations says there is a change. On me I see only no change.
I am really sorry if i give wrong information. I hope you meant this:
python manage.py makemigrations store storefront-FK5d6ZFd Py
Migrations for ‘store’:
store/migrations/0001_initial.py
- Create model Adresses
- Create model Cart
- Create model CartItem
- Create model Collection
- Create model Customer
- Create model Order
- Create model OrderItem
- Create model Promotion
- Create model Product
python3 manage.py makemigrations 3 ✘ 9s storefront-FK5d6ZFd Py
It is impossible to add a non-nullable field ‘collection’ to product without specifying a default. This is because the database needs something to populate existing rows.
Please select a fix:
Provide a one-off default now (will be set on all existing rows with a null value for this column)
Quit and manually define a default value in models.py.
meanwhile I followed 1:1 video course. In this course every model has been entered with : not =
Do you have any existing rows in your product table in your database? If not then I usually select option 1 and just enter a 1. Nothing will happen since you don’t have any rows to update.
The equal-sign-thingy is stated in lesson 5-Creating models aswell as the official documentation. If you’ve seen a field in a model being defined with a colon I think that is a mistake