Django 3.1.
app folder : stocks
project folder with settings inside: main
I have this model:
class Bar(models.Model):
stock = models.CharField(max_length=10)
timestamp = models.DateTimeField()
date = models.DateField()
time = models.TimeField()
open = models.DecimalField(max_digits=6, decimal_places=2)
high = models.DecimalField(max_digits=6, decimal_places=2)
low = models.DecimalField(max_digits=6, decimal_places=2)
close = models.DecimalField(max_digits=6, decimal_places=2)
is_regular = models.BooleanField()
change = models.DecimalField(max_digits=10, decimal_places=4)
In the SQLite database I have created view daily_bottoms
from that model using SQliteStudio.
Now I am trying to migrate because added another field. makemigrations
works fine, but when trying to migrate I get an error:
django.db.utils.OperationalError: error in view daily_bottoms: no such table: main.stocks_bar
If I delete the view then it will migrate , but I would like to avoid that every time.
How to make it work?
question from:
https://stackoverflow.com/questions/65645758/django-migration-error-when-database-has-custom-views 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…