Explorar o código

[core] Invert dependency list and merge migrations

Merging migration history will make it seem as though desktop/0007
ran first, but it will actually run after beeswax/0008, oozie/0025,
and pig/0001 when these apps are available. During the build process,
sycndb and migrate commands are ran before the apps are installed,
but after desktop is installed. So desktop/0007 will run first there.
Then, after the apps are installed, syncdb and migrate are executed
again. Here, the proper order will be respected.
Abraham Elmahrek %!s(int64=11) %!d(string=hai) anos
pai
achega
11582cbdbc

+ 4 - 0
apps/beeswax/src/beeswax/migrations/0008_auto__add_field_queryhistory_query_type.py

@@ -6,6 +6,10 @@ from django.db import models
 
 class Migration(SchemaMigration):
 
+    needed_by = (
+        ("desktop", "0007_auto__add_documentpermission__add_documenttag__add_document"),
+    )
+
     def forwards(self, orm):
 
         # Adding field 'QueryHistory.query_type'

+ 3 - 0
apps/oozie/src/oozie/migrations/0025_change_examples_path_format.py

@@ -6,6 +6,9 @@ from south.v2 import DataMigration
 from django.db import models
 
 class Migration(DataMigration):
+    needed_by = (
+        ("desktop", "0007_auto__add_documentpermission__add_documenttag__add_document"),
+    )
 
     def forwards(self, orm):
         """Migrate from ["path1", "path2", ...] to [{"name":"path1"},{"name":"path2"},...]"""

+ 3 - 0
apps/pig/src/pig/migrations/0001_initial.py

@@ -5,6 +5,9 @@ from south.v2 import SchemaMigration
 from django.db import models
 
 class Migration(SchemaMigration):
+    needed_by = (
+        ("desktop", "0007_auto__add_documentpermission__add_documenttag__add_document"),
+    )
 
     def forwards(self, orm):
 

+ 1 - 1
desktop/Makefile

@@ -90,7 +90,7 @@ $(DESKTOP_DB): $(BLD_DIR_BIN)/hue
 	fi
 	@echo "--- Syncing/updating database at $@"
 	@$(ENV_PYTHON) $(BLD_DIR_BIN)/hue syncdb --noinput
-	@$(ENV_PYTHON) $(BLD_DIR_BIN)/hue migrate
+	@$(ENV_PYTHON) $(BLD_DIR_BIN)/hue migrate --merge
 
 # Targets that simply recurse into all of the applications
 ENV_INSTALL_TARGETS := $(APPS:%=.recursive-env-install/%)

+ 0 - 5
desktop/core/src/desktop/migrations/0007_auto__add_documentpermission__add_documenttag__add_document.py

@@ -7,11 +7,6 @@ from django.db import models
 from desktop.models import Document
 
 class Migration(SchemaMigration):
-    depends_on = (
-      ("oozie", "0025_change_examples_path_format"),
-      ("pig", "0001_initial"),
-      ("beeswax", "0008_auto__add_field_queryhistory_query_type"),
-    )
     
     def forwards(self, orm):
         

+ 1 - 1
tools/app_reg/build.py

@@ -58,5 +58,5 @@ def make_syncdb():
   hue_exec = os.path.join(common.INSTALL_ROOT, 'build', 'env', 'bin', 'hue')
   if os.path.exists(hue_exec):
     statuses.append( runcmd([ hue_exec, 'syncdb', '--noinput' ]) )
-    statuses.append( runcmd([ hue_exec, 'migrate' ]) )
+    statuses.append( runcmd([ hue_exec, 'migrate', '--merge' ]) )
   return not any(statuses)