Django Migrate command throwing ORA-00955 error
Clash Royale CLAN TAG#URR8PPP
Django Migrate command throwing ORA-00955 error
I have an oracle 12c
existing database.
oracle 12c
I used inspectdb
to create the django models. Most of the tables in the db dont have a primary key and I assume that if pk
is not set explicitly, then Django would apply the id
column as the primary key to the tables.
inspectdb
pk
id
Also, I have set managed=True
on all my models so, Django should ideally be able to create the id
column for its use.
managed=True
id
When I run makemigrations
, I dont get any error. But when I run migrate after that I get the following error:-
makemigrations
return self.cursor.execute(query, self._param_generator(params))
django.db.utils.DatabaseError: ORA-00955:
name is already used by an existing object
Any clue why I am getting this error?
I dont think I fully understand the solution. Also it is for pre 1.7, Django I am using is 2.7.
– KChow
Aug 6 at 18:32
1 Answer
1
Update:-
So, I found out that the issue was with the initial migration itself. Since, the tables were already existing in my case, it might have taken it as duplicate object names when trying to migrate the first time. I had to fake the initial migration so that it only checks if the tables exist for the models and if it does then migrate. Below is the command for the same. It worked perfectly and my initial migration was successful.
python manage.py makemigrations
python manage.py migrate --fake-initial
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I don't know if this is relevant in your case but you might check code.djangoproject.com/ticket/24407.
– Bob Jarvis
Aug 6 at 16:42