You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
set -e
INITDB_FOLDER="/opt/mssql-scripts"
TMP_DIR="/tmp"functionsqlcmd() {
file=${1?"Sql file must be provided as a parameter"}
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "${SA_PASSWORD}" -i "${file}"echo"$file imported successfully"
}
functioninitialize_app_database() {
# Restore the application database using .sql filesshopt -s globstar nullglob
forfilein"$INITDB_FOLDER"/*.sql;do
sqlcmd "$file"done# Restore the application database using .sql.gz filesshopt -s globstar nullglob
forfilein"$INITDB_FOLDER"/*.sql.gz;doecho"Uncompressing $file to $TMP_DIR"
filename=$(basename "$file")
uncompressed_file="$TMP_DIR/${filename//.gz/}"# TODO Check if it's possible to pipe output directly to sqlcmd (checked -i -, however it didn´t seem to be supported ). as an alternative mkfifo can be reviewed as well
gunzip --keep --stdout "$file">"$uncompressed_file"
sqlcmd "$uncompressed_file"done# Restore the application database using .sh filesshopt -s globstar nullglob
forfilein"$INITDB_FOLDER"/*.sh;doecho"Importing $file"if [ -x"$file" ];then"$file"
https://github.com/nanlabs/infra-reference/blob/f129254bb893310107de4529419c8e57e85b2b66/examples/docker/mssql/entrypoint.sh#L27
┆Issue is synchronized with this Clickup task by Unito
The text was updated successfully, but these errors were encountered: