should we make one model and do migration and make another model and make migration, migrate for another model. Or i can just make many models as i want and just do migration once.
You can do a makemigrations
on as many models and apps as you’d like. There’s no need to make them more discrete than that.
I made a model in models.py there are other models also but my one model is not in data base, how can this happen?
There are about a dozen different ways this could happen, without knowing everything you’ve done, we’ve got no way to know the exact cause.
If this is a new model, is it also a new app? If it is, see the makemigrations docs regarding the migrations
directory in that app.
If it’s not a new app, did you do a migrate
after the makemigrations
? Can you check your migration files to see if there’s an operation in them to create that table?
I might try doing a migrate
on a completely different / clean database to see if the table gets created there.
While i try to do" python manage.py migrate" it gives me error because i gave the wrong value whent the terminal asked me to give the value. So i was not able to migrate.
Ok, then you can fix your migration file - find in the file where the wrong value is being assigned and replace it with an appropriate value.
how can i read migration file?
It’s just Python code within your ‘migrations’ directory. You can read / edit it like any other Python code. The Migration Files docs describe the contents and directives contained within them.
yeah, i did it thank you so much.