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 table
statement which is execute for Postgres (it is not the one you posted). – a_horse_with_no_name Apr 9 at 13:59sql
command only prints the SQL statements. – There is noCREATE TABLE
statement 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 asyncdb
command to load the data from the JSON fixture (created from the MySQL DB usingdumpdata
). – janeden Apr 9 at 14:59