librenms-librenms/scripts/deploy-schema.sh
Neil Lathwood 03deb6434a feature: Added ability to validate database schema (#6303)
* feature: Added ability to validate database schema

* small scrut fixes

* Check for extra tables and columns
Print 30 items of schema updates, easier to copy paste sql

* Now supports detections and suggested fix for:
tables: missing, extra
columns: missing, extra, incorrect
indexes: missing, extra, incorrect

* final changes + hook into travis
2017-04-05 09:00:28 +01:00

15 lines
407 B
Bash
Executable File

#!/bin/bash
GH_REPO="@github.com/librenms/librenms.git"
FULL_REPO="https://${GH_TOKEN}$GH_REPO"
git config user.name "librenms"
git config user.email "travis@librenms.org"
DBTEST=1 ./scripts/build-schema.php > misc/db_schema.yaml
STATUS=$(git status -s misc/db_schema.yaml)
if [[ "$STATUS" != "" ]]; then
git commit -m "DB Schema updated by travis after $TRAVIS_COMMIT"
git push -q origin master
fi