Reputation: 91
I added a new model in models.py. And I am successfully done with makemigrations. During makemigrations, I haven't faced any issue. But when I tried to migrate this model to the DB server, I am getting error as django.db.utils.DatabaseError: ORA-00955: name is already used by an existing object.
I am sure that there is no other model name with this new model name.
Could you please let me know what is the issue and the resolution. Thanks in advance
models.py
class ProdServersMountPoints(models.Model):
mountpoint = models.CharField(max_length=100)
check_fabs_servers = models.BooleanField()
check_oc_servers = models.BooleanField()
class Meta:
db_table = 'PROD_SERVERS_MOUNTPOINTS'
def __str__(self):
return str(self.mountpoint)
Error:
(venv_2.7.12) -bash-4.1$ python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, fabi, sessions
Running migrations:
Applying fabi.0002_auto_20171205_0057...Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
fake_initial=fake_initial,
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/migrations/migration.py", line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 96, in database_forwards
schema_editor.create_model(model)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 295, in create_model
self.execute(sql, params or None)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 112, in execute
cursor.execute(sql, params)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
File "/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/backends/oracle/base.py", line 481, in execute
return self.cursor.execute(query, self._param_generator(params))
django.db.utils.DatabaseError: ORA-00955: name is already used by an existing object
Upvotes: 0
Views: 1511
Reputation: 1087
Why not print out the failing sql and determine what is the cause, edit the following:
"/scratch/kvkumari/tools_setup/Python/framework/venv_2.7.12/lib/python2.7/site-packages/django/db/backends/oracle/base.py", Just before line 481 where the execute function is called add:
print query
This will show you the failing sql query. You can then remove or rename the failing sql table or object
Upvotes: 1