[Django]-Django.db.utils.OperationalError: (1091, "Can't DROP 'company_id'; check that column/key exists")

1👍

You can take a look at the py file in the migrations folder and comment out the erroneous remove in the operations list operate.

-2👍

The easiest way to solve this is to remake the database from scratch.

  1. If you are using SQLite. Delete the file and delete all files from the migration folder and try creating the migration file again.
  2. If you are using MySQL or PostgreSQL delete all the tables and try again. don’t forget to delete the migration files else this won’t
    work.
    This problem arises when you had a foreign key and you deleted the column without removing the depending data.

Leave a comment