Drop DB object only if they exist

This commit is contained in:
Disassembler 2018-10-31 09:55:46 +01:00
parent 61fab326c3
commit 905f2c62c1
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
17 changed files with 17 additions and 17 deletions

View File

@ -11,7 +11,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE ckan; DROP DATABASE ckan_datastore; DROP ROLE ckan; DROP ROLE ckan_datastore;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS ckan; DROP DATABASE IF EXISTS ckan_datastore; DROP ROLE IF EXISTS ckan; DROP ROLE IF EXISTS ckan_datastore;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
# Remove redis data # Remove redis data

View File

@ -8,7 +8,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE crisiscleanup; DROP ROLE crisiscleanup;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS crisiscleanup; DROP ROLE IF EXISTS crisiscleanup;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
exit 0 exit 0

View File

@ -8,7 +8,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE gnuhealth; DROP DATABASE gnuhealth_demo; DROP ROLE gnuhealth;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS gnuhealth; DROP DATABASE IF EXISTS gnuhealth_demo; DROP ROLE IF EXISTS gnuhealth;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
exit 0 exit 0

View File

@ -11,7 +11,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE kanboard; DROP ROLE kanboard;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS kanboard; DROP ROLE IF EXISTS kanboard;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
exit 0 exit 0

View File

@ -2,4 +2,4 @@ DELETE FROM mysql.user WHERE User != 'root' OR Host != 'localhost';
INSTALL PLUGIN unix_socket SONAME 'auth_socket'; INSTALL PLUGIN unix_socket SONAME 'auth_socket';
UPDATE mysql.user SET plugin='unix_socket'; UPDATE mysql.user SET plugin='unix_socket';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
DROP DATABASE test; DROP DATABASE IF EXISTS test;

View File

@ -8,7 +8,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1 [ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1
echo 'DROP DATABASE `mifosplatform-tenants`; DROP DATABASE `mifostenant-default`; DROP USER `mifosx`;' | lxc-attach mariadb -- mysql echo 'DROP DATABASE IF EXISTS `mifosplatform-tenants`; DROP DATABASE IF EXISTS `mifostenant-default`; DROP USER IF EXISTS `mifosx`;' | lxc-attach mariadb -- mysql
[ ! -z ${STOP_MARIADB} ] && service mariadb stop [ ! -z ${STOP_MARIADB} ] && service mariadb stop
exit 0 exit 0

View File

@ -8,7 +8,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE motech; DROP DATABASE motechdata; DROP DATABASE motechquartz; DROP DATABASE motechschema; DROP ROLE motech;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS motech; DROP DATABASE IF EXISTS motechdata; DROP DATABASE IF EXISTS motechquartz; DROP DATABASE IF EXISTS motechschema; DROP ROLE IF EXISTS motech;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
# TODO: Clear ActiveMQ config # TODO: Clear ActiveMQ config

View File

@ -8,7 +8,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE opendatakitbuild; DROP ROLE opendatakitbuild;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS opendatakitbuild; DROP ROLE IF EXISTS opendatakitbuild;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
exit 0 exit 0

View File

@ -8,7 +8,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE opendatakit; DROP ROLE opendatakit;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS opendatakit; DROP ROLE IF EXISTS opendatakit;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
exit 0 exit 0

View File

@ -8,7 +8,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE openmapkit; DROP ROLE openmapkit;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS openmapkit; DROP ROLE IF EXISTS openmapkit;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
exit 0 exit 0

View File

@ -8,7 +8,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE pandora; DROP ROLE pandora;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS pandora; DROP ROLE IF EXISTS pandora;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
# Remove RabbitMQ vhost and user # Remove RabbitMQ vhost and user

View File

@ -8,7 +8,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE sahanademo; DROP ROLE sahanademo;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS sahanademo; DROP ROLE IF EXISTS sahanademo;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
exit 0 exit 0

View File

@ -8,7 +8,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE sahana; DROP ROLE sahana;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS sahana; DROP ROLE IF EXISTS sahana;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
exit 0 exit 0

View File

@ -8,7 +8,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE sambro; DROP ROLE sambro;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS sambro; DROP ROLE IF EXISTS sambro;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
exit 0 exit 0

View File

@ -11,7 +11,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE seeddms; DROP ROLE seeddms;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS seeddms; DROP ROLE IF EXISTS seeddms;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
exit 0 exit 0

View File

@ -8,7 +8,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
echo 'DROP DATABASE sigmah; DROP ROLE sigmah;' | lxc-attach -u 5432 -g 5432 postgres -- psql echo 'DROP DATABASE IF EXISTS sigmah; DROP ROLE IF EXISTS sigmah;' | lxc-attach -u 5432 -g 5432 postgres -- psql
[ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop
exit 0 exit 0

View File

@ -11,7 +11,7 @@ rc-update -u
# Drop database and user # Drop database and user
[ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1 [ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1
echo 'DROP DATABASE ushahidi; DROP USER ushahidi;' | lxc-attach mariadb -- mysql echo 'DROP DATABASE IF EXISTS ushahidi; DROP USER IF EXISTS ushahidi;' | lxc-attach mariadb -- mysql
[ ! -z ${STOP_MARIADB} ] && service mariadb stop [ ! -z ${STOP_MARIADB} ] && service mariadb stop
exit 0 exit 0