[SEBA-477] Removing service generated migrations from the core repository and expanding documentation

Change-Id: If6353db935c82ac2e40cb67bf81b7d245fe1252a
diff --git a/VERSION b/VERSION
index 7ec3b24..f1cd7fa 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.1.48
+2.1.49
diff --git a/containers/chameleon/Dockerfile.chameleon b/containers/chameleon/Dockerfile.chameleon
index 5889507..a608e77 100644
--- a/containers/chameleon/Dockerfile.chameleon
+++ b/containers/chameleon/Dockerfile.chameleon
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/chameleon
-FROM xosproject/xos-base:2.1.48
+FROM xosproject/xos-base:2.1.49
 
 # xos-base already has protoc and dependencies installed
 
diff --git a/containers/xos/Dockerfile.client b/containers/xos/Dockerfile.client
index 42b2e76..a6a229b 100644
--- a/containers/xos/Dockerfile.client
+++ b/containers/xos/Dockerfile.client
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-client
-FROM xosproject/xos-libraries:2.1.48
+FROM xosproject/xos-libraries:2.1.49
 
 
 # Install XOS client
diff --git a/containers/xos/Dockerfile.libraries b/containers/xos/Dockerfile.libraries
index f82db50..eeb22a8 100644
--- a/containers/xos/Dockerfile.libraries
+++ b/containers/xos/Dockerfile.libraries
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-libraries
-FROM xosproject/xos-base:2.1.48
+FROM xosproject/xos-base:2.1.49
 
 # Add libraries
 COPY lib /opt/xos/lib
diff --git a/containers/xos/Dockerfile.synchronizer-base b/containers/xos/Dockerfile.synchronizer-base
index c4c47a7..06d9fa0 100644
--- a/containers/xos/Dockerfile.synchronizer-base
+++ b/containers/xos/Dockerfile.synchronizer-base
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-synchronizer-base
-FROM xosproject/xos-client:2.1.48
+FROM xosproject/xos-client:2.1.49
 
 COPY xos/synchronizers/new_base /opt/xos/synchronizers/new_base
 COPY xos/xos/logger.py /opt/xos/xos/logger.py
diff --git a/containers/xos/Dockerfile.xos-core b/containers/xos/Dockerfile.xos-core
index cf04559..4b30bdf 100644
--- a/containers/xos/Dockerfile.xos-core
+++ b/containers/xos/Dockerfile.xos-core
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-core
-FROM xosproject/xos-libraries:2.1.48
+FROM xosproject/xos-libraries:2.1.49
 
 # Install XOS
 ADD xos /opt/xos
diff --git a/docs/dev/xosmigrate.md b/docs/dev/xosmigrate.md
index 668c038..b5d4352 100644
--- a/docs/dev/xosmigrate.md
+++ b/docs/dev/xosmigrate.md
@@ -133,4 +133,23 @@
 Here are some good reads about migrations:
 
 - <https://realpython.com/django-migrations-a-primer/#creating-migrations>
-- <https://realpython.com/data-migrations/>
\ No newline at end of file
+- <https://realpython.com/data-migrations/>
+
+## Development workflow
+
+During development multiple changes to the models are often necessary. In order to continuously upgrade the service to
+proceed with development we suggest to generate a new migration every time the models are changed. This is required to
+upgrade the service multiple times during the development loop (as the core expects new migrations).
+
+This will probably lead to multiple migration files by the time your feature is complete, for example:
+
+```yaml
+- 0003-modelA-fieldA.py
+- 0004-modelA-fieldB.py
+...
+- 0007-modelB-fieldX.py
+```
+
+However, in order to maintain clarity, we suggest to submit a single migration as part of a patch.
+To do that you can simply remove all the migrations you have generated as part of your development and run the
+`xos-migrate` tool again. This will generate a single migration file for all your changes.
diff --git a/lib/xos-migrate/xosmigrate/main.py b/lib/xos-migrate/xosmigrate/main.py
index e6901e2..f4620de 100644
--- a/lib/xos-migrate/xosmigrate/main.py
+++ b/lib/xos-migrate/xosmigrate/main.py
@@ -36,7 +36,7 @@
 
 def get_abs_path(dir_):
     if os.path.isabs(dir_):
-        return dir_
+        return os.path.realpath(dir_)
     if dir_[0] == '~' and not os.path.exists(dir_):
         dir_ = os.path.expanduser(dir_)
         return os.path.abspath(dir_)
@@ -54,8 +54,6 @@
     log.info(r"---------------------------------------------------------------")
     log.debug("CORD repo root", root=root)
     log.debug("Storing logs in: %s" % os.environ["LOG_FILE"])
-    # log.debug("Config schema: %s" % os.environ['XOS_CONFIG_SCHEMA'])
-    # log.debug("Config: %s" % os.environ['XOS_CONFIG_FILE'])
     log.debug(r"---------------------------------------------------------------")
 
 
@@ -207,13 +205,14 @@
     :param service_name: string (name of the service)
     :return: void
     """
-    # FIXME Django eats this message
     log.debug("Copying %s migrations to %s" % (service_name, service_dir))
     migration_dir = os.path.join(service_dest_dir, service_name, "migrations")
     dest_dir = os.path.join(service_dir, "xos", "synchronizer", "migrations")
     if os.path.isdir(dest_dir):
         shutil.rmtree(dest_dir)  # empty the folder, we'll copy everything again
     shutil.copytree(migration_dir, dest_dir)
+    # clean after the tool, generated migrations has been moved in the service repo
+    shutil.rmtree(get_abs_path(os.path.join(migration_dir, "../")))
 
 
 def monkey_patch_migration_template():