librenms-librenms/scripts/deploy-schema.sh
Tony Murray b1483e3d2e feature: Unit test to validate the db schema (#6367)
* Unit test to validate the db schema
Changes build-schema.php to just write misc/db_schema.yaml

* Only build base if needed
Fix 178.sql

* Database is always created by init.php
add dbSchema test too, should guard against testing against an empty database

* feature: support non-standard unix socket (#5724)

* Add support for custom MySQL unix-socket

* NULL must be lowercase!

* Naive edit of html/install.php

* fixup

* Refactor dbConnect
Use it everywhere

* $config needs to be global
Don't need to set $database_link

* small cleanups

* Connect to the database for every test.

* travis fix for blank line
2017-04-07 15:07:44 +01:00

22 lines
567 B
Bash
Executable File

#!/bin/bash
GH_REPO="@github.com/librenms/librenms.git"
FULL_REPO="https://${GH_TOKEN}:x-oauth-basic$GH_REPO"
DBTEST=1 ./scripts/build-schema.php
STATUS=$(git status -s misc/db_schema.yaml)
if [[ "$STATUS" != "" ]]; then
mkdir -p _schema
cd _schema
git init
git remote add origin $FULL_REPO
git fetch
git config user.name "lnms-docs"
git config user.email "travis@librenms.org"
git checkout master
cp ../misc/db_schema.yaml misc/db_schema.yaml
git commit -a -m "DB Schema updated by travis after $TRAVIS_COMMIT"
git push -q origin master
fi