2015-07-07 9 views
7

Io uso django_celery con la connessione ad Amazon Redshift. Per migrare il database, dopo "makemigrations" ho usato il comando "python manage.py migrate" e il messaggio di errore appare come mostrato sotto.La colonna 'django_migrations.id' ha un tipo non supportato 'seriale' [con Amazon Redshift]

Il motivo è che Redshift non supporta il tipo di dati "seriale" ma la tabella "django_migrations" che contiene il tipo "seriale" viene creata automaticamente.

Come interrompere Django Migrations creare questa tabella o evitare l'uso di serie sulla tabella 'django_migrations'.

D:\code\test_celery_django>python manage.py migrate 
Traceback (most recent call last): 
    File "manage.py", line 10, in <module> 
    execute_from_command_line(sys.argv) 
    File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line 
    utility.execute() 
    File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 330, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "C:\Python27\lib\site-packages\django\core\management\base.py", line 390, in run_from_argv 
    self.execute(*args, **cmd_options) 
    File "C:\Python27\lib\site-packages\django\core\management\base.py", line 441, in execute 
    output = self.handle(*args, **options) 
    File "C:\Python27\lib\site-packages\django\core\management\commands\migrate.py", line 93, in handle 
    executor = MigrationExecutor(connection, self.migration_progress_callback) 
    File "C:\Python27\lib\site-packages\django\db\migrations\executor.py", line 19, in __init__ 
    self.loader = MigrationLoader(self.connection) 
    File "C:\Python27\lib\site-packages\django\db\migrations\loader.py", line 47, in __init__ 
    self.build_graph() 
    File "C:\Python27\lib\site-packages\django\db\migrations\loader.py", line 180, in build_graph 
    self.applied_migrations = recorder.applied_migrations() 
    File "C:\Python27\lib\site-packages\django\db\migrations\recorder.py", line 59, in applied_migrations 
    self.ensure_schema() 
    File "C:\Python27\lib\site-packages\django\db\migrations\recorder.py", line 53, in ensure_schema 
    editor.create_model(self.Migration) 
    File "C:\Python27\lib\site-packages\django\db\backends\base\schema.py", line 286, in create_model 
    self.execute(sql, params or None) 
    File "C:\Python27\lib\site-packages\django\db\backends\base\schema.py", line 111, in execute 
    cursor.execute(sql, params) 
    File "C:\Python27\lib\site-packages\django\db\backends\utils.py", line 79, in execute 
    return super(CursorDebugWrapper, self).execute(sql, params) 
    File "C:\Python27\lib\site-packages\django\db\backends\utils.py", line 64, in execute 
    return self.cursor.execute(sql, params) 
    File "C:\Python27\lib\site-packages\django\db\utils.py", line 97, in __exit__ 
    six.reraise(dj_exc_type, dj_exc_value, traceback) 
    File "C:\Python27\lib\site-packages\django\db\backends\utils.py", line 62, in execute 
    return self.cursor.execute(sql) 
django.db.utils.NotSupportedError: Column "django_migrations.id" has unsupported type "serial". 
+0

sto vedendo la stessa cosa: sei riuscito a capirlo? – josephmisiti

+0

quale driver di database stai usando? – Jerzyk

risposta

0

Stai cercando di utilizzare Redshift come database di back-end per la tua applicazione web? Questa è una cattiva idea, Redshift è un data warehouse e in quanto tali prestazioni e latenza delle query individuali sono tutt'altro che grandiose, per non parlare del fatto che Redshift non impone le chiavi primarie, che quasi sicuramente Django si aspetta.

La mia raccomandazione, utilizzare PostgreSQL.

Problemi correlati