Prometheus
Prometheus

Reputation: 33585

django south error migration fails

Can anyone explain this error to me when trying to use sudo python manage.py migrate core. Thank you.

(django-env)pc-03:Ares user$ sudo python manage.py migrate core
Running migrations for core:
 - Migrating forwards to 0001_initial.
 > core:0001_initial
FATAL ERROR - The following SQL query failed: CREATE TABLE `country` (`countryID` varchar(255) NOT NULL PRIMARY KEY, `abbreviation` varchar(15) NOT NULL, `name` varchar(105) NOT NULL, `prefix` varchar(15) NOT NULL, `active` longtext NOT NULL, `created` datetime NULL, `modified` datetime NULL);
The error was: (1050, "Table 'country' already exists")
 ! Error found during real run of migration! Aborting.

 ! Since you have a database that does not support running
 ! schema-altering statements in transactions, we have had 
 ! to leave it in an interim state between migrations.

! You *might* be able to recover with:   = DROP TABLE `country` CASCADE; []
   = DROP TABLE `company` CASCADE; []
   = DROP TABLE `campaign` CASCADE; []
   = DROP TABLE `redemptionMethod` CASCADE; []
   = DROP TABLE `incentiveCost` CASCADE; []
   = DROP TABLE `incentive` CASCADE; []
   = DROP TABLE `recipient` CASCADE; []
   = DROP TABLE `code` CASCADE; []
   = DROP TABLE `redeemed` CASCADE; []

 ! The South developers regret this has happened, and would
 ! like to gently persuade you to consider a slightly
 ! easier-to-deal-with DBMS (one that supports DDL transactions)
 ! NOTE: The error which caused the migration to fail is further up.
Error in migration: core:0001_initial

Upvotes: 1

Views: 2300

Answers (1)

Hui Zheng
Hui Zheng

Reputation: 10224

Error is self-explanatory: "Table 'country' already exists", which means you already have the table 'country' created in the database. To avoid that, you can run the initial migration as fake:

sudo python manage.py migrate core --fake

Upvotes: 4

Related Questions