Skip to content

Commit a2a98dc

Browse files
authored
mssql 18
1 parent b3b2904 commit a2a98dc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

script/run-initialization.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@ echo "Database initialisaton"
1111
# if the table does not exsit it will create the table
1212

1313
# get "1" if the database exist : tr get only the integer, cut only the first integer (the second is the number of row affected)
14-
data=$(/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $SA_PASSWORD -Q "SELECT COUNT(*) FROM master.dbo.sysdatabases WHERE name = N'$DB_NAME'" | tr -dc '0-9'| cut -c1 )
15-
if [ ${data} -eq "0" ]; then
14+
data=$(/opt/mssql-tools/bin/sqlcmd18 -S localhost -U SA -P $SA_PASSWORD -Q "SELECT COUNT(*) FROM master.dbo.sysdatabases WHERE name = N'$DB_NAME'" | tr -dc '0-9'| cut -c1 )
15+
if [[ ${data} -eq "0" ]]; then
1616
echo 'download full demo database'
1717
echo 'create database user'
18-
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $SA_PASSWORD -Q "CREATE LOGIN $DB_USER WITH PASSWORD='${SA_PASSWORD}', CHECK_POLICY = OFF"
18+
/opt/mssql-tools/bin/sqlcmd18 -S localhost -U SA -P $SA_PASSWORD -Q "CREATE LOGIN $DB_USER WITH PASSWORD='${SA_PASSWORD}', CHECK_POLICY = OFF"
1919
echo "merging files"
2020
./concatenate_files.sh
2121
echo 'create database'
2222
#/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $SA_PASSWORD -Q "DROP DATABASE IF EXISTS $DB_NAME"
23-
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $SA_PASSWORD -Q "CREATE DATABASE $DB_NAME"
23+
/opt/mssql-tools/bin/sqlcmd18 -S localhost -U SA -P $SA_PASSWORD -Q "CREATE DATABASE $DB_NAME"
2424

25-
if [ "$INIT_MODE" = "demo" ]; then
26-
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $SA_PASSWORD -i output/fullDemoDatabase.sql -d $DB_NAME | grep . | uniq -c
25+
if [[ "$INIT_MODE" = "demo" ]]; then
26+
/opt/mssql-tools/bin/sqlcmd18 -S localhost -U SA -P $SA_PASSWORD -i output/fullDemoDatabase.sql -d $DB_NAME | grep . | uniq -c
2727
else
28-
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $SA_PASSWORD -i output/fullEmptyDatabase.sql -d $DB_NAME | grep . | uniq -c
28+
/opt/mssql-tools/bin/sqlcmd18 -S localhost -U SA -P $SA_PASSWORD -i output/fullEmptyDatabase.sql -d $DB_NAME | grep . | uniq -c
2929
fi
3030
echo ' give to the user the access to the database'
31-
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $SA_PASSWORD -Q "EXEC sp_changedbowner '$DB_USER'" -d $DB_NAME
31+
/opt/mssql-tools/bin/sqlcmd18 -S localhost -U SA -P $SA_PASSWORD -Q "EXEC sp_changedbowner '$DB_USER'" -d $DB_NAME
3232
else
3333
echo "database already existing, nothing to do"
3434
fi

0 commit comments

Comments
 (0)