I have added new model to my app. I did makemigration and in my migration I can see the code to create my models like:
operations = [
migrations.CreateModel(
name='Blog',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title', models.CharField(max_length=120)),
('body', models.TextField()),
('post_date', models.DateTimeField(default=django.utils.timezone.now)),
('like', models.IntegerField(default=0)),
('created_by', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
},
bases=(models.Model,),
Now when I do python manage.py migrate
it gives me error saying table does not exist..
Why I am getting this error. It should have been migrated right ? How to fix this issue?
python manage.py makemigrations
python manage.py migrate --fake
else
python manage.py schemamigration someapp --auto
python manage.py migrate someapp --fake
Reference: https://stackoverflow.com/a/27583836/4359237
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With