forked from sequelize/sequelize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor-setup.ps1
39 lines (32 loc) · 1.24 KB
/
appveyor-setup.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Set-Service sqlbrowser -StartupType auto
Start-Service sqlbrowser
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | Out-Null
$wmi = New-Object('Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer')
$tcp = $wmi.GetSmoObject("ManagedComputer[@Name='${env:computername}']/ServerInstance[@Name='SQL2016']/ServerProtocol[@Name='Tcp']")
$tcp.IsEnabled = $true
$tcp.Alter()
$wmi = New-Object('Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer')
$ipall = $wmi.GetSmoObject("ManagedComputer[@Name='${env:computername}']/ServerInstance[@Name='SQL2016']/ServerProtocol[@Name='Tcp']/IPAddress[@Name='IPAll']")
$port = $ipall.IPAddressProperties.Item("TcpDynamicPorts").Value
$config = @{
instanceName = "SQL2016"
host = "localhost"
username = "sa"
password = "Password12!"
port = $port
database = "master"
dialectOptions = @{
requestTimeout = 25000
cryptoCredentialsDetails = @{
ciphers = "RC4-MD5"
}
}
pool = @{
max = 5
idle = 3000
}
}
$json = $config | ConvertTo-Json -Depth 3
# cannot use Out-File because it outputs a BOM
[IO.File]::WriteAllLines((Join-Path $pwd "test\config\mssql.json"), $json)