File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
django_cassandra_engine/management/commands Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1010 sync_table
1111)
1212from django_cassandra_engine .utils import get_engine_from_db_alias
13+ from django .apps import apps
14+ from django .db .models .signals import post_migrate
15+
16+
17+ def emit_post_migrate_signal (verbosity , interactive , db ):
18+ # Emit the post_migrate signal for every application.
19+ for app_config in apps .get_app_configs ():
20+ if app_config .models_module is None :
21+ continue
22+ if verbosity >= 2 :
23+ print ("Running post-migrate handlers for application %s" % app_config .label )
24+ post_migrate .send (
25+ sender = app_config ,
26+ app_config = app_config ,
27+ verbosity = verbosity ,
28+ interactive = interactive ,
29+ using = db )
1330
1431
1532class Command (NoArgsCommand ):
@@ -93,3 +110,7 @@ def handle_noargs(self, **options):
93110 if cassandra_alias is None :
94111 raise CommandError (
95112 'Please add django_cassandra_engine backend to DATABASES!' )
113+
114+ # Send the post_migrate signal, so individual apps can do whatever they need
115+ # to do at this point.
116+ emit_post_migrate_signal (1 , False , cassandra_alias )
You can’t perform that action at this time.
0 commit comments