You are here

mssql.sh in Drupal driver for SQL Server and SQL Azure 3.1.x

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-$1.list)"
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/prod.list)"
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y mssql-server mssql-tools unixodbc-dev
export MSSQL_SA_PASSWORD=Password12!
export ACCEPT_EULA=Y
export MSSQL_PID=Evaluation
export SIMPLETEST_BASE_URL=http://127.0.0.1
sudo /opt/mssql/bin/mssql-conf setup
sleep 15
# testing collate as LATIN1_GENERAL_100_CI_AS_SC_UTF8 or Latin1_General_CI_AI
/opt/mssql-tools/bin/sqlcmd -P Password12! -S localhost -U SA -Q "CREATE DATABASE mydrupalsite COLLATE ${DB_COLLATION}"
# Install the pdo_sqlsrv extension
sudo ACCEPT_EULA=Y apt-get -y install msodbcsql17 unixodbc-dev gcc g++ make autoconf libc-dev pkg-config
pecl install sqlsrv pdo_sqlsrv
yes "autodetect" | pecl install yaml
# Install REGEX CLR
wget https://github.com/Beakerboy/drupal-sqlsrv-regex/releases/download/1.0/RegEx.dll
sudo mv RegEx.dll /var/opt/mssql/data/
/opt/mssql-tools/bin/sqlcmd -P Password12! -S localhost -U SA -d mydrupalsite -Q "EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'clr strict security', 0; RECONFIGURE; EXEC sp_configure 'clr enable', 1; RECONFIGURE"
/opt/mssql-tools/bin/sqlcmd -P Password12! -S localhost -U SA -d mydrupalsite -Q "CREATE ASSEMBLY Regex from '/var/opt/mssql/data/RegEx.dll' WITH PERMISSION_SET = SAFE"
/opt/mssql-tools/bin/sqlcmd -P Password12! -S localhost -U SA -d mydrupalsite -Q "CREATE FUNCTION dbo.REGEXP(@pattern NVARCHAR(100), @matchString NVARCHAR(100)) RETURNS bit EXTERNAL NAME Regex.RegExCompiled.RegExCompiledMatch"

File

dev/travis/mssql.sh
View source
  1. wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
  2. sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-$1.list)"
  3. sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/prod.list)"
  4. sudo apt-get update
  5. sudo ACCEPT_EULA=Y apt-get install -y mssql-server mssql-tools unixodbc-dev
  6. export MSSQL_SA_PASSWORD=Password12!
  7. export ACCEPT_EULA=Y
  8. export MSSQL_PID=Evaluation
  9. export SIMPLETEST_BASE_URL=http://127.0.0.1
  10. sudo /opt/mssql/bin/mssql-conf setup
  11. sleep 15
  12. # testing collate as LATIN1_GENERAL_100_CI_AS_SC_UTF8 or Latin1_General_CI_AI
  13. /opt/mssql-tools/bin/sqlcmd -P Password12! -S localhost -U SA -Q "CREATE DATABASE mydrupalsite COLLATE ${DB_COLLATION}"
  14. # Install the pdo_sqlsrv extension
  15. sudo ACCEPT_EULA=Y apt-get -y install msodbcsql17 unixodbc-dev gcc g++ make autoconf libc-dev pkg-config
  16. pecl install sqlsrv pdo_sqlsrv
  17. yes "autodetect" | pecl install yaml
  18. # Install REGEX CLR
  19. wget https://github.com/Beakerboy/drupal-sqlsrv-regex/releases/download/1.0/RegEx.dll
  20. sudo mv RegEx.dll /var/opt/mssql/data/
  21. /opt/mssql-tools/bin/sqlcmd -P Password12! -S localhost -U SA -d mydrupalsite -Q "EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'clr strict security', 0; RECONFIGURE; EXEC sp_configure 'clr enable', 1; RECONFIGURE"
  22. /opt/mssql-tools/bin/sqlcmd -P Password12! -S localhost -U SA -d mydrupalsite -Q "CREATE ASSEMBLY Regex from '/var/opt/mssql/data/RegEx.dll' WITH PERMISSION_SET = SAFE"
  23. /opt/mssql-tools/bin/sqlcmd -P Password12! -S localhost -U SA -d mydrupalsite -Q "CREATE FUNCTION dbo.REGEXP(@pattern NVARCHAR(100), @matchString NVARCHAR(100)) RETURNS bit EXTERNAL NAME Regex.RegExCompiled.RegExCompiledMatch"