2016-04-29 12 views
0

私はpostgres dbに移行する際に問題があります。エラーが発生しました。「サーバーエラーが発生しました。管理者に連絡してください。ページ上に私が作るしようとすると、コンソールでは、私はエラーをrecive migrateコマンド:Djangoはsqliteから整数のpostgresに移動する

エラー:

Synchronizing apps without migrations: 
    Creating tables... 
    Running deferred SQL... 
    Installing custom SQL... 
Running migrations: 
    Rendering model states... DONE 
    Applying core.0002_auto_20160427_1326...Traceback (most recent call last): 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\backends\utils.py", line 64, in execute 
    return self.cursor.execute(sql, params) 
psycopg2.ProgrammingError: ERROR: column "revival" cannot be cast to type integer 
HINT: "USING revival::integer". 


The above exception was the direct cause of the following exception: 

Traceback (most recent call last): 
    File "C:\Program Files (x86)\JetBrains\PyCharm 5.0.2\helpers\pycharm\django_manage.py", line 41, in <module> 
    run_module(manage_file, None, '__main__', True) 
    File "C:\Program Files (x86)\Python35-32\Lib\runpy.py", line 182, in run_module 
    return _run_module_code(code, init_globals, run_name, mod_spec) 
    File "C:\Program Files (x86)\Python35-32\Lib\runpy.py", line 96, in _run_module_code 
    mod_name, mod_spec, pkg_name, script_name) 
    File "C:\Program Files (x86)\Python35-32\Lib\runpy.py", line 85, in _run_code 
    exec(code, run_globals) 
    File "C:/Users/loc/PycharmProjects/CRM\manage.py", line 10, in <module> 
    execute_from_command_line(sys.argv) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\core\management\__init__.py", line 354, in execute_from_command_line 
    utility.execute() 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\core\management\__init__.py", line 346, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\core\management\base.py", line 394, in run_from_argv 
    self.execute(*args, **cmd_options) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\core\management\base.py", line 445, in execute 
    output = self.handle(*args, **options) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\core\management\commands\migrate.py", line 222, in handle 
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\migrations\executor.py", line 110, in migrate 
    self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\migrations\executor.py", line 148, in apply_migration 
    state = migration.apply(state, schema_editor) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\migrations\migration.py", line 115, in apply 
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\migrations\operations\fields.py", line 201, in database_forwards 
    schema_editor.alter_field(from_model, from_field, to_field) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\backends\base\schema.py", line 484, in alter_field 
    old_db_params, new_db_params, strict) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\backends\postgresql_psycopg2\schema.py", line 107, in _alter_field 
    new_db_params, strict, 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\backends\base\schema.py", line 636, in _alter_field 
    params, 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\backends\base\schema.py", line 111, in execute 
    cursor.execute(sql, params) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\backends\utils.py", line 79, in execute 
    return super(CursorDebugWrapper, self).execute(sql, params) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\backends\utils.py", line 64, in execute 
    return self.cursor.execute(sql, params) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\utils.py", line 98, in __exit__ 
    six.reraise(dj_exc_type, dj_exc_value, traceback) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\utils\six.py", line 685, in reraise 
    raise value.with_traceback(tb) 
    File "C:\Users\loc\dJangoEnvironment\lib\site-packages\django\db\backends\utils.py", line 64, in execute 
    return self.cursor.execute(sql, params) 
django.db.utils.ProgrammingError: ERROR: column "revival" cannot be cast to type integer 
HINT: "USING revival::integer". 


Process finished with exit code 1 

モデル魔女復活フィールド:

class Task(models.Model): 
    name = models.CharField(max_length=80, blank=True, null=True) 
    deadline_date = models.DateField(null=True, blank=True) 
    created_date = models.DateTimeField(auto_now_add=True, editable=False) 
    finished_date = models.DateTimeField(null=True, blank=True) 
    modified_date = models.DateTimeField(auto_now=True, editable=False) 
    responsible_group = models.ForeignKey(Group) 
    responsible_user = models.ForeignKey(User, blank=True, null=True, related_name='+') 
    revival = models.IntegerField(blank=True, null=True) 
    creator = models.ForeignKey(User, blank=True, null=True, related_name='+') 
    modified_user = models.ForeignKey(User, blank=True, null=True, related_name='+') 
    client = models.ForeignKey(Client, blank=True, null=True) 
    order = models.OneToOneField(Order, blank=True, null=True, on_delete=models.CASCADE) 
    platform = models.ForeignKey(Platform, blank=True, null=True, on_delete=models.PROTECT) 
    comment = models.ForeignKey("Comment", blank=True, null=True, related_name='+') 
    status = models.ForeignKey(TaskStatus, default=1, on_delete=models.PROTECT) 

は、あなたがどのように解決するために私にいくつかのアドバイスを与えることができますこの?

答えて

1

復活のタイプがの整数になる前に別のタイプがあるとします。だから私はそれを試してみる:

1) At first comment out revival

2) makemigrations and migrate

3) undo commented code containing revival

4) makemigrations and migrate

幸運!

関連する問題