migrating sqlite to postgres

Hello pros, I am getting key error migrating sqlite to postgres, how do I resolve issues caused by changing a model name while I was using sqlite but postgres is trying to look for the old model name which already has a new name, please help e rookie lol

Welcome @oldfox010 !

You’ve got a couple different options, depending upon your precise situation, how large your current installed base is, and whether or not you’re looking to continue to support both SQLite to PostgreSQL.

If this is a complete move from SQLite to PostgreSQL, and you don’t need to worry about your SQLite version any more, the easiest thing to do is just delete all your migration files and recreate them before running migrate on your PostgreSQL database.

If you need to keep working with SQLite, you can still do this if you back up your data and run the new migrations on a new database file. You can then copy the data from the old DB to the new one.

On the other hand, if you’ve got a number of deployed instances where it’s not practical to recreate them all, you can try running the migrations on your PostgreSQL version one at a time. For example, if you’ve got an app named myapp that has 4 migrations numbered 0001 through 0004, you could run python manage.py migrate myapp 0001, then python manage.py migrate myapp 0002 - and so on. (See the migrate docs.)