You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem Statement
I'm having trouble integrating with my particular use case:
DATABASES = {
'default': {...}, // this is the Django auto-generated DB where I want historical records stored
'external_app': {...} // my model instances live in this external DB
}
My users are also maintained in the default DB.
Describe the solution you'd like
I want historical records to be written to the default app_data Django DB (where admin models are also stored).
Describe alternatives you've considered
Having setup my settings.py accordingly, let MyModel be the model instance of the external db, I've tried:
Simple integration
// This tries to write to `external_app` DB
class MyModel(models.Model):
history = HistoricalRecords()
Use different app param
// This does not migrate/auto-generate in `default` DB
class MyModel(models.Model):
history = HistoricalRecords(app="MyApp") // which routes to the `default` DB
Try bases
// This throws a conflict on `id` field of `MyModel` and `MyHistoricalRecord`
class MyHistoricalRecord:
class Meta:
app_label = 'default'
managed = True
class MyModel(models.Model):
history = HistoricalRecords(app="MyApp", bases=[MyHistoricalRecord]) // which routes to the `default` DB
Seems like 2) is the closest to my desired solution -- however the tables don't exist and when I try to run makemigrations no changes are made.
The text was updated successfully, but these errors were encountered:
Problem Statement
I'm having trouble integrating with my particular use case:
My users are also maintained in the
default
DB.Describe the solution you'd like
I want historical records to be written to the default
app_data
Django DB (where admin models are also stored).Describe alternatives you've considered
Having setup my
settings.py
accordingly, letMyModel
be the model instance of the external db, I've tried:Seems like 2) is the closest to my desired solution -- however the tables don't exist and when I try to run
makemigrations
no changes are made.The text was updated successfully, but these errors were encountered: