Skip to content
Snippets Groups Projects
Commit f844c3f2 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: get working

parent caef918c
No related branches found
No related tags found
No related merge requests found
...@@ -32,8 +32,6 @@ fi ...@@ -32,8 +32,6 @@ fi
source $UTILSPATH/load_settings.sh source $UTILSPATH/load_settings.sh
source $UTILSPATH/helpers.sh source $UTILSPATH/helpers.sh
INSTALL_SQL_FILE="db_2_0.sql"
set -e set -e
function fail() { function fail() {
...@@ -201,9 +199,9 @@ EOF ...@@ -201,9 +199,9 @@ EOF
# The first argument to this function is the database that shal be dropped. # The first argument to this function is the database that shal be dropped.
function drop() { function drop() {
DROPDB="$1" DROPDB="$1"
#for host in ${DATABASE_USER_HOST_LIST//,/ } ; do for host in ${DATABASE_USER_HOST_LIST//,/ } ; do
#$MYSQL_CMD $(get_mysql_args_nodb) -e "DROP USER '${DATABASE_USER}'@'${host}';" || true $MYSQL_CMD $(get_mysql_args_nodb) -e "DROP USER '${DATABASE_USER}'@'${host}';" || true
#done done
"$MYSQLADMIN_CMD" $(get_mysql_args_nodb) -f drop "$DROPDB" "$MYSQLADMIN_CMD" $(get_mysql_args_nodb) -f drop "$DROPDB"
} }
......
...@@ -24,15 +24,6 @@ SHELL=/bin/bash ...@@ -24,15 +24,6 @@ SHELL=/bin/bash
INSTALL_SQL_FILE=db_2_0.sql INSTALL_SQL_FILE=db_2_0.sql
# TODO can this be removed?
#ifdef LOGIN_PATH
# M_MYSQL_CONNECTION=--login-path=$(M_LOGIN_PATH)
#else
# MYSQL_CONNECTION=--host="$(MYSQL_HOST)" --port="$(MYSQL_PORT)" \
# --user="$(MYSQL_USER)" --password="$(MYSQL_USER_PASSWORD)"
#endif
.PHONY: test-connection .PHONY: test-connection
test-connection: test-connection:
./make_db test-connection ./make_db test-connection
......
...@@ -25,10 +25,9 @@ ...@@ -25,10 +25,9 @@
# #
#apply all available patches. #apply all available patches.
set -e
PATCHES="./patch*/patch.sh" PATCHES="./patch*/patch.sh"
. $UTILSPATH/helpers.sh
set -e
for p in $PATCHES for p in $PATCHES
do do
$p "$@" --patch=$p $p "$@" --patch=$p
......
...@@ -35,7 +35,7 @@ fi ...@@ -35,7 +35,7 @@ fi
check_version $OLD_VERSION check_version $OLD_VERSION
function addIdx { function addIdx {
$MYSQL_CMD $(get_con_args) -e "ALTER TABLE $1 ADD COLUMN pidx TINYINT UNSIGNED NOT NULL DEFAULT 0;" $MYSQL_CMD $(get_db_args) -e "ALTER TABLE $1 ADD COLUMN pidx TINYINT UNSIGNED NOT NULL DEFAULT 0;"
} }
addIdx "reference_data" addIdx "reference_data"
......
...@@ -24,17 +24,16 @@ ...@@ -24,17 +24,16 @@
# Updates all SQL procedures # Updates all SQL procedures
. utils/load_settings.sh source $UTILSPATH/helpers.sh
. utils/helpers.sh
echo -n "updating rules ... " echo -n "updating rules ... "
set -e set -e
mysql_execute "$(sed s/db_2_0/$DATABASE_NAME/g rules.sql)" mysql_execute "$(sed s/db_2_0/$DATABASE_NAME/g rules.sql)"
success echo "OK"
echo -n "updating procedures ... " echo -n "updating procedures ... "
mysql_execute "$(sed s/db_2_0/$DATABASE_NAME/g procedures/*.sql procedures/query/*.sql)" mysql_execute "$(sed s/db_2_0/$DATABASE_NAME/g procedures/*.sql procedures/query/*.sql)"
success echo "OK"
...@@ -75,7 +75,7 @@ function backup() { ...@@ -75,7 +75,7 @@ function backup() {
failure "dumpfile already exists." failure "dumpfile already exists."
fi fi
echo "Dumping database $NARG_NAME to $NARG_FILE ... " echo "Dumping database $NARG_NAME to $NARG_FILE ... "
$MYSQLDUMP_CMD $(get_con_args_no_db) $* --opt --default-character-set=utf8 --routines \ $MYSQLDUMP_CMD $(get_mysql_args_no_db) $* --opt --default-character-set=utf8 --routines \
"$NARG_NAME" > "$NARG_FILE" "$NARG_NAME" > "$NARG_FILE"
if [[ "$YAML" == "true" ]] ; then if [[ "$YAML" == "true" ]] ; then
......
...@@ -18,10 +18,6 @@ ...@@ -18,10 +18,6 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
function dump_table {
$MYSQLDUMP_CMD $(get_db_args_nodb) $DATABASE_NAME $1 \
> ${DATABASE_NAME}.${1}.${OLD_VERSION}.dump.sql
}
function mysql_execute { function mysql_execute {
#TODO is it meaningful that here always the database user is used??? #TODO is it meaningful that here always the database user is used???
...@@ -35,18 +31,10 @@ function mysql_execute { ...@@ -35,18 +31,10 @@ function mysql_execute {
} }
function get_mysql_args { function get_mysql_args {
# if [ "$DATABASE_NAME" = "caosdb" ];then
# echo "WRONGDB"
# exit 1
# fi
echo "$(get_mysql_args_nodb) --database=$DATABASE_NAME" echo "$(get_mysql_args_nodb) --database=$DATABASE_NAME"
} }
function get_db_args { function get_db_args {
# if [ "$DATABASE_NAME" = "caosdb" ];then
# echo "WRONGDB"
# exit 1
# fi
echo "$(get_db_args_nodb) --database=$DATABASE_NAME" echo "$(get_db_args_nodb) --database=$DATABASE_NAME"
} }
...@@ -86,10 +74,6 @@ function get_mysql_args_nodb { ...@@ -86,10 +74,6 @@ function get_mysql_args_nodb {
echo $mysql_con_arguments echo $mysql_con_arguments
} }
function redo_table {
$MYSQL_CMD $(get_db_args) < ${DATABASE_NAME}.${1}.${OLD_VERSION}.dump.sql
}
function success { function success {
echo "[OK]" echo "[OK]"
exit 0 exit 0
......
...@@ -121,3 +121,14 @@ function check_version { ...@@ -121,3 +121,14 @@ function check_version {
function update_version { function update_version {
mysql_execute "DROP FUNCTION IF EXISTS CaosDBVersion; CREATE FUNCTION CaosDBVersion() RETURNS VARCHAR(255) DETERMINISTIC RETURN '$1';" mysql_execute "DROP FUNCTION IF EXISTS CaosDBVersion; CREATE FUNCTION CaosDBVersion() RETURNS VARCHAR(255) DETERMINISTIC RETURN '$1';"
} }
function dump_table {
$MYSQLDUMP_CMD $(get_db_args_nodb) $DATABASE_NAME $1 \
> ${DATABASE_NAME}.${1}.${OLD_VERSION}.dump.sql
}
function redo_table {
$MYSQL_CMD $(get_db_args) < ${DATABASE_NAME}.${1}.${OLD_VERSION}.dump.sql
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment