1

I'm working with a legacy mysql db with from a php project that is active so I can't change its schema, I've used inspectdb to create the models, now I want to add foreign keys to the models that aren't present , is there a way to do that without modifying the db?

For example: inspectdb gives me two models:

class OwaDocument(models.Model):
    url = models.CharField(max_length=255, blank=True, null=True)
    page_title = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'owa_document'

class OwaReferer(models.Model):
    url = models.CharField(max_length=255, blank=True, null=True)
    site_name = models.CharField(max_length=255, blank=True, null=True)
    site = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'owa_referer'

And I want to add a new field that doesn't exist, but without modifying my db

Pablo K
  • 125
  • 1
  • 10

1 Answers1

0

No, I think you need to modify the DB.

r007
  • 305
  • 1
  • 2
  • 17