I am trying to migrate a MySQL-based Django project to PostgreSQL. Unfortunately, all sql/syncdb commands fail as soon as I switch the database backend in settings.py.
python manage.py sql profile w/ MySQL:
BEGIN;
CREATE TABLE `profile_department` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` varchar(100) NOT NULL UNIQUE,
[...]
python manage.py sql profile w/ PostgreSQL (psycopg2):
DatabaseError: relation "profile_department" does not exist
LINE 1: ...nt"."homepage", "profile_department"."gd_id" FROM "profile_d...
^
Why does Django behave differently with the two DB backends?
create tablestatement which is execute for Postgres (it is not the one you posted).sqlcommand only prints the SQL statements. – There is noCREATE TABLEstatement when the PostgreSQL statement is used – just this error message. – I am not querying from the DB, just trying to create the table in my new (empty) PostgreSQL database (if that succeeds, I'll clean out the DB and issue asyncdbcommand to load the data from the JSON fixture (created from the MySQL DB usingdumpdata).