i try to connect two database tables with a foreign key and i get the error
ORA-00904: "A"."A_NR_ID": invalid identifier
for the model:
class A(models.Model):
id = models.IntegerField(primary_key=True)
a_nr = models.ForeignKey(B, models.DO_NOTHING)
--> #anr = models.ForeignKey(B, models.DO_NOTHING, db_column="a_nr")
f_b = models.CharField(max_length=1)
...
class B(models.Model):
id = models.IntegerField(primary_key=True)
...
If i replace a_nr with the comment-line anr it works. And i have no idea why, since the name only uses single underscore. Also the column f_b seems to work perfectly fine.
If i then run "makemigrations" it trys to delete the column a_nr and create anr, which also makes no sense to me, since i thought db_column="a_nr" would keep the actuall name in the oracle database the same.
The second error is:
ORA-00904: "D"."BEZEICHNUNG_ID": invalid identifier
for the model:
class C(models.Model):
id = models.IntegerField(primary_key=True)
bezeichnung = models.CharField()
class D(models.Model):
id = models.IntegerField(primary_key=True)
bezeichnung = models.ForeignKey(C, models.DO_NOTHING)
...
And here i can't figure out what's wrong.