After some errors, I dropped my database, deleted all my migration files (I left init.py). Now, when I run
python migrate.py makemigrations /
Delete folder migrations and re-run. It works for me
From Django docs, Options.managed: "If False, no database table creation or deletion operations will be performed for this model."
And I see you have
options={
'db_table': 'tblclients',
'managed': False,
},
Try setting managed=True
in the model.
First try this;
Check your migration files for the app, if you have the create model portion in your migrations file, remove it and redo migrations. I.e remove this; migrations.CreateModel( name='YourModelName', ....... .....)
(venv)root@debian:~/Desktop/project$ python manage.py makemigrations appName
(venv)root@debian:~/Desktop/project$ python manage.py migrate appName
Else; navigate to your database and delete all migrations for that app, you may have to drop the related tables too.
postgres=# \c db_yourdb
db_yourdb=# delete from django_migrations where app='appName';
then go to your code and;
(venv)root@debian:~/Desktop/project$ python manage.py makemigrations appName
(venv)root@debian:~/Desktop/project$ python manage.py migrate appName
To do fresh migrations entirely, first do the necessary deletions for migrations and droping the tables if need be then;
(venv)root@debian:~/Desktop/project$ find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
(venv)root@debian:~/Desktop/project$ find . -path "*/migrations/*.pyc" -delete
finally do;
(venv)root@debian:~/Desktop/project$ python manage.py makemigrations
(venv)root@debian:~/Desktop/project$ python manage.py migrate
Read more here on how to reset migrations
In my case, what created the tables was this:
python manage.py migrate --run-syncdb
I am using Django 1.9.6.