1

I am getting below error when I am migrating from django SQLite to PostgreSQL.

django.db.utils.ProgrammingError: cannot cast type smallint to boolean
LINE 1: ... "merchant_view" TYPE boolean USING "merchant_view"::boolean

I am able to see all the tables in Postgresql even the table which is giving me above error. But in Postgresql its datatype have changed from Boolean to smallint. I am not also not able to change the datatype from smallint to boolean in postresql. Most of the fields has Boolean datatype in postgresql.I dont know what causing this error. How can i solve this error.

My Model
class ContractLineItems(CommomFields):
    payment_app_id = models.AutoField(primary_key = True)
    code = models.CharField(max_length=11,unique=True)
    module = models.ForeignKey(ContractManager,on_delete=models.CASCADE)
    description = models.CharField(max_length=255)
    buy_rate = models.DecimalField(max_digits=10,decimal_places=10)
    default_rev_share = models.DecimalField(max_digits=10,decimal_places=10)
    list_price = models.DecimalField(max_digits=10,decimal_places=10)
    billing_type = models.ForeignKey("BillingType",on_delete=models.CASCADE)
    merchant_view = models.BooleanField(default=False)
    bound_descreption = models.CharField(max_length=255)
    user_id = None
    trash = None
    deleted_at = None
    deleted_by = None

Thanks in Advance.

1 Answer 1

1

Issue Solved.

In Migration files field name merchant_view was first declared as smallPositiveInteger. So while migrating to postgresql it was accepting the first declaration. So I deleted all migrated files and ran makemigrations it worked for me

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.