Explorar el Código

Call out dependency on v2.11+ for upgrades

jeremystretch hace 4 años
padre
commit
ae6b2be52c
Se han modificado 2 ficheros con 19 adiciones y 0 borrados
  1. 3 0
      docs/release-notes/version-3.0.md
  2. 16 0
      upgrade.sh

+ 3 - 0
docs/release-notes/version-3.0.md

@@ -2,6 +2,9 @@
 
 ## v3.0-beta1 (FUTURE)
 
+!!! warning "Existing Deployments Must Upgrade from v2.11"
+    Upgrading an existing NetBox deployment to version 3.0 **must** be done from version 2.11.0 or later. If attempting to upgrade a deployment of NetBox v2.10 or earlier, first upgrade to a NetBox v2.11 release, and then upgrade from v2.11 to v3.0. This will avoid any problems with the schema migration optimizations implemented in version 3.0.
+
 ### Breaking Changes
 
 * Python 3.6 is no longer supported.

+ 16 - 0
upgrade.sh

@@ -56,6 +56,22 @@ else
   echo "Skipping local dependencies (local_requirements.txt not found)"
 fi
 
+# Test schema migrations integrity
+COMMAND="python3 netbox/manage.py showmigrations"
+eval $COMMAND > /dev/null 2>&1 || {
+  echo "--------------------------------------------------------------------"
+  echo "ERROR: Database schema migrations are out of synchronization. (No"
+  echo "data has been lost.) If attempting to upgrade to NetBox v3.0 or"
+  echo "later, first upgrade to a v2.11 release to ensure schema migrations"
+  echo "have been correctly prepared. For further detail on the exact error,"
+  echo "run the following commands:"
+  echo ""
+  echo "    source ${VIRTUALENV}/bin/activate"
+  echo "    ${COMMAND}"
+  echo "--------------------------------------------------------------------"
+  exit 1
+}
+
 # Apply any database migrations
 COMMAND="python3 netbox/manage.py migrate"
 echo "Applying database migrations ($COMMAND)..."