Django Migrate issue
Question: A django model created as follows

    
    
    from django.db import models
    
    class Vender(models.Model):
        id  =models.IntegerField(primary_key=True)
        name = models.CharField(max_length=30)
        class Meta:
            db_table="vendor"
    
    class car(models.Model):
        id  =models.IntegerField(primary_key=True)
        Vender=models.ForeignKey(Vender)
        carmodel =models.CharField(max_length=30)
        class Meta:
            db_table="car"
    

Initially `makemigration` and `migrate` worked fine. Then I changed some model
fields and options. After that getting the below error. I am new to Django.
This kind of issues is happen in production how we can solve with out
effecting live transaction data.

    
    
    F:\Workspace\virtspace\demosrc>python manage.py migrate
    Operations to perform:
      Apply all migrations: admin, contenttypes, base, auth, sessions
    Running migrations:
      Applying base.0003_auto_20150110_2004...Traceback (most recent call last):
      File "manage.py", line 10, in <module>
        execute_from_command_line(sys.argv)
      File "D:\Python27\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line
        utility.execute()
      File "D:\Python27\lib\site-packages\django\core\management\__init__.py", line 377, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
      File "D:\Python27\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
        self.execute(*args, **options.__dict__)
      File "D:\Python27\lib\site-packages\django\core\management\base.py", line 338, in execute
        output = self.handle(*args, **options)
      File "D:\Python27\lib\site-packages\django\core\management\commands\migrate.py", line 160, in handle
        executor.migrate(targets, plan, fake=options.get("fake", False))
      File "D:\Python27\lib\site-packages\django\db\migrations\executor.py", line 63, in migrate
        self.apply_migration(migration, fake=fake)
      File "D:\Python27\lib\site-packages\django\db\migrations\executor.py", line 97, in apply_migration
        migration.apply(project_state, schema_editor)
      File "D:\Python27\lib\site-packages\django\db\migrations\migration.py", line 107, in apply
        operation.database_forwards(self.app_label, schema_editor, project_state, new_state)
      File "D:\Python27\lib\site-packages\django\db\migrations\operations\fields.py", line 84, in database_forwards
        schema_editor.remove_field(from_model, from_model._meta.get_field_by_name(self.name)[0])
      File "D:\Python27\lib\site-packages\django\db\backends\schema.py", line 439, in remove_field
        self.execute(sql)
      File "D:\Python27\lib\site-packages\django\db\backends\schema.py", line 99, in execute
        cursor.execute(sql, params)
      File "D:\Python27\lib\site-packages\django\db\backends\utils.py", line 81, in execute
        return super(CursorDebugWrapper, self).execute(sql, params)
      File "D:\Python27\lib\site-packages\django\db\backends\utils.py", line 65, in execute
        return self.cursor.execute(sql, params)
      File "D:\Python27\lib\site-packages\django\db\utils.py", line 94, in __exit__
        six.reraise(dj_exc_type, dj_exc_value, traceback)
      File "D:\Python27\lib\site-packages\django\db\backends\utils.py", line 65, in execute
        return self.cursor.execute(sql, params)
      File "D:\Python27\lib\site-packages\django\db\backends\oracle\base.py", line 916, in execute
        return self.cursor.execute(query, self._param_generator(params))
    django.db.utils.DatabaseError: ORA-00904: "ID": invalid identifier
    


Answer: you dont need

    
    
    id  =models.IntegerField(primary_key=True)
    

django adds it for you. dont worry about it.

delete these fields, `makemigrations`, `migrate` and you are fine.

