Type char exceeds 10485760 error margin still showing after I change the limit to something less than MAX

I have a django application, I transfer its database from sqlite3 to postgres, I get the following line of errors, since I got a field in one of the models set to 500000000, so I changed it to 10485750 and executed:

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 the change i made feel

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)
+4
source share
1 answer

what type of field are you using? Django has models.TextField () for https://docs.djangoproject.com/en/2.0/ref/models/fields/#django.db.models.TextField for large texts

? ,

+2

Source: https://habr.com/ru/post/1693449/


All Articles