Reputation: 63
I have a django app, I'm migrating it's database from sqlite3 to postgres, i get the following error line since i got a field in one of the models set to 500000000 so i changed it to 10485750 and ran:
python manage.py makemigrations app
python manage.py sqlmigrate app 0001
python manage.py migrate
but still got the following error
django.db.utils.DataError: length for type varchar cannot exceed 10485760 LINE 1: ...ber" TYPE varchar(500000000) USING ........
how can I make it feel the change I made?
Model:
class PartyDetails(models.Model):
model_number=models.CharField(max_length=270)
item_instance_number = models.IntegerField(primary_key=True)
contract_model_quantity = models.IntegerField(null=True)
item_group = models.CharField(max_length=250 )
tla_serial_number = models.CharField(max_length=250, blank=True )
product_tla_flag = models.CharField(max_length=250, blank=True )
location = models.CharField(max_length=250)
install_base_status = models.CharField(max_length=250)
cust_number = models.TextField()
cust_name = models.CharField(max_length=250)
contract_number = models.CharField(max_length=250, blank=True )
contract_subline_status = models.CharField(max_length=250 )
contract_subline_start_date = models.CharField(max_length=250,null=True )
contract_subline_end_date = models.CharField( max_length=250,null=True)
end_life_date = models.CharField(max_length=250,blank=True,null=True )
nested_level = models.IntegerField(null=True)
primary_contract_flag = models.CharField(max_length=250, blank=True,null=True )
def get_absolute_url(self,*args,**kwargs):
#return reverse('party-details',kwargs={'pk': self.pk})
return reverse('index')
def __str__(self):
return "item_instance_number =" + str(self.item_instance_number)
Upvotes: 4
Views: 848
Reputation: 186
what field type you using? In Django for big texts have models.TextField() class https://docs.djangoproject.com/en/2.0/ref/models/fields/#django.db.models.TextField
Are you generate new migration? I recomend clear migrations for this app and generate new, because model is valid
Upvotes: 2