The errors I am getting while migrating on PostgreSQL Heroku. Note: It is working fine on the local server.
Traceback (most recent call last): File "/app/manage.py", line 22, in <module> main() File "/app/manage.py", line 18, in main execute_from_command_line(sys.argv) File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line utility.execute() File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv self.execute(*args, **cmd_options) File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute output = self.handle(*args, **options) File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 89, in wrapped res = handle_func(*args, **kwargs) File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 244, in handle post_migrate_state = executor.migrate( File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/executor.py", line 227, in apply_migration state = migration.apply(state, schema_editor) File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/migration.py", line 126, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/operations/fields.py", line 104, in database_forwards schema_editor.add_field( File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 522, in add_field self.execute(sql, params) File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 145, in execute cursor.execute(sql, params) File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers return executor(sql, params, many, context) File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/app/.heroku/python/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) **django.db.utils.DataError: value too long for type character varying(30)**
there is no column with 30 lengths even tried migrating after deleting all data and still getting the same error.
This is the model of the project models.py
from django.db import models from django.contrib.auth.models import User from django.db.models.fields import AutoField from django.utils.timezone import now class pageinfo(models.Model): page_id=models.IntegerField(AutoField,primary_key=True); # thumbnail=models.ImageField(null=True,blank=True); channellink=models.URLField(null=True,default='#') logo= models.URLField(null=True,blank=True); youtube_link1=models.URLField(null=True,default='#') youtube_link2=models.URLField(null=True,default='#') title=models.CharField(max_length=150,null=True); display_title=models.CharField(max_length=150,null=True); subscriber=models.CharField(max_length=15,null=True); description=models.TextField(null=True) ratingtitle1=models.CharField(max_length=150,default='Course Depth') ratingtitle2=models.CharField(max_length=150,default='Language Clarity') ratingtitle3=models.CharField(max_length=150,default='How interactive videos are') ratingtitle4=models.CharField(max_length=150,default='Quality of Content') # Create your models here. class review(models.Model): # id=models.ForeignKey(pageinfo,on_delete=models.CASCADE,primary_key=True) comment=models.CharField(max_length=1000,null=True); type=models.CharField(max_length=120,null=False) username= models.ForeignKey(User,on_delete=models.CASCADE, null=True); timeStamp=models.DateTimeField(default=now) class rating(models.Model): # id=models.ForeignKey(pageinfo,on_delete=models.CASCADE,primary_key=True) rate=models.IntegerField(); type=models.CharField(max_length=120,null=False) username= models.ForeignKey(User,on_delete=models.CASCADE,null=True); email=models.CharField(max_length=80,default='') timeStamp=models.DateTimeField(default=now) class languagerating(models.Model): # id=models.ForeignKey(pageinfo,on_delete=models.CASCADE,primary_key=True) rate=models.IntegerField(); type=models.CharField(max_length=120,null=False) email=models.CharField(max_length=80,default='') username= models.ForeignKey(User,on_delete=models.CASCADE,null=True); timeStamp=models.DateTimeField(default=now) class interactionrating(models.Model): # id=models.ForeignKey(pageinfo,on_delete=models.CASCADE,primary_key=True) rate=models.IntegerField(); type=models.CharField(max_length=120,null=False) email=models.CharField(max_length=80,default='') username= models.ForeignKey(User,on_delete=models.CASCADE,null=True); timeStamp=models.DateTimeField(default=now) class qualityrating(models.Model): # id=models.ForeignKey(pageinfo,on_delete=models.CASCADE,primary_key=True) rate=models.IntegerField(); type=models.CharField(max_length=120,null=False) email=models.CharField(max_length=80,default='') username= models.ForeignKey(User,on_delete=models.CASCADE,null=True); timeStamp=models.DateTimeField(default=now) # class user_detai(models.Model): # username=models.CharField(max_length=50); # email=models.CharField(max_length=50) # password=models.CharField( max_length=50) class Info(models.Model): name=models.CharField(max_length=40,default='') email=models.CharField(max_length=80, null=True, ); comment=models.CharField(max_length=1000, null=True);