-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Child class in different app #21
Comments
I think I understand the problem. You're altering a
|
Thank you craigds for your answer. Solution 1 (copy created migration file from core-app to plugin-app) is exactly what I did short after I created this issue. It worked. Solution 2: Consider not doing this? .... I need plugins and the core does not now all plugins. The core knows some plugins, but I don't want to enforce this. If I would, I can't call it "plugin", since it is required. Background: A plugin can be created by different people and different companies. There is no central version control for core and plugins. Is it possible to alter typed models, so that south creates the migrations per plugin? Like the copy solution? How could this be done? |
I thought about this again: In traditional DB design this pattern is wide spread and best practice: There is a core application. It provides the database an some base tables. Optional third party plugin-apps are allowed to create tables in this database. With Single-Table-Inheritance the design "a plugin-app is allowed to create new tables" changes to "a plugin-app is allowed to create new columns". Like in traditional DB design the core app does not know all tables, since some are optional and provided by third party packages, with STI we have: The core app does not know all columns of its tables. At first this makes FUD (Fear, Uncertainty and Doubt), but I personally like STI very much. .... at the moment I only see this small problem, that south needs to create the migrations in the plugin app, not the core app. |
Next (small) trouble ...
The solutions suggested by south did not help. My solution: Past: I copied the migration from core-app to plugin-app. Unfortunately now south does not want to guess he current DB schema. Now I created an empty migration which freezes core-app and plugin-app. Copied the freezed models (code below forward()/backward() methods) to the copied migration. Deleted the empyte migration, and now the great |
Im not sure this core/plugin situation is well suited to STI, since STI
|
Hi, i moved the generated migration into my_plugin/migrations/ and everything works fine. Thank you for your support. I don't want to close this issue, since I think it should be documented. |
My solution which uses typedmodels is live since some days. All works well. The way descripted in this tickets works fine: The core-app defines a PluginBase and third party apps can implement this API by (single table) inheritance. The only thing which is not perfect at the moment: if you create a schemamigration with south, south does create the migration file always in the core-app. But a simple move (and renumber) helps. Thank you very much for django-typed-models |
There is a central app
core
which defines a classPlugin
and there is an optional appmy_plugin
which subclasses fromPlugin
.I run
manage.py schemamigration my_plugin --auto
, butNothing seems to have changed.
.I need to run
manage.py schemamigration core --auto
to get the changes dumped to a migration file.This does not work, since
core
does not depend onmy_plugin
. The plugin should be optional. The relevant schema migrations need to be in the app ofmy_plugin
.Did you understand my problem?
What can I do?
The text was updated successfully, but these errors were encountered: