@@ -11,24 +11,24 @@ echo "Database initialisaton"
11
11
# if the table does not exsit it will create the table
12
12
13
13
# 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
16
16
echo ' download full demo database'
17
17
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"
19
19
echo " merging files"
20
20
./concatenate_files.sh
21
21
echo ' create database'
22
22
# /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 "
24
24
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
27
27
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
29
29
fi
30
30
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
32
32
else
33
33
echo " database already existing, nothing to do"
34
34
fi
0 commit comments