Skip to content

Commit 55ff37f

Browse files
dockerised db
1 parent b2a8fa4 commit 55ff37f

File tree

18 files changed

+262
-225
lines changed

18 files changed

+262
-225
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,5 @@ Paket.Restore.targets
236236
/docs/output
237237
docs/output/**/*.*
238238
*.orig
239+
240+
tests/SqlClient.Tests/AdventureWorks2012_Data.mdf

build.fsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,19 @@ Target.create "DeployTestDB" (fun _ ->
174174

175175
ZipFile.ExtractToDirectory(testsSourceRoot @@ (dataFileName + ".zip"), testsSourceRoot)
176176

177+
printfn "Copying file to docker: %s" sourceMdf
178+
179+
Shell.Exec("docker", "exec fsharpdatasqlclient_fsharp-tp-sql_1 mkdir -p /var/opt/mssql/attached") |> ignore
180+
Shell.Exec("docker", (sprintf "cp %A %A" sourceMdf "fsharpdatasqlclient_fsharp-tp-sql_1:/var/opt/mssql/attached")) |> ignore
177181

178182
let dataPath =
179183
use cmd = new SqlCommand("SELECT SERVERPROPERTY('InstanceDefaultDataPath')", conn)
180184
cmd.ExecuteScalar() |> string
181185
do
182-
let destFileName = dataPath @@ Path.GetFileName(sourceMdf)
183-
File.Copy(sourceMdf, destFileName, overwrite = true)
184-
File.Delete( sourceMdf)
186+
let parent (path: string) = path.Substring(0, path.LastIndexOf("/"))
187+
let destFileName = sprintf "%s/attached/%s" (parent (parent dataPath)) (Path.GetFileName(sourceMdf))
188+
//File.Copy(sourceMdf, destFileName, overwrite = true)
189+
//File.Delete( sourceMdf)
185190
use cmd = new SqlCommand(Connection = conn)
186191
cmd.CommandText <- sprintf "CREATE DATABASE [%s] ON ( FILENAME = N'%s' ) FOR ATTACH" database destFileName
187192
cmd.ExecuteNonQuery() |> ignore

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: "3"
2+
services:
3+
fsharp-tp-sql:
4+
image: microsoft/mssql-server-linux:2017-latest
5+
environment:
6+
SA_PASSWORD: "type-providers-are-pretty-neat-N1#"
7+
ACCEPT_EULA: "Y"
8+
MSSQL_AGENT_ENABLED: "true"
9+
ports:
10+
- "5002:1433"

paket.dependencies

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ group Build
2222
group Library
2323
source https://www.nuget.org/api/v2/
2424
framework: >= netstandard20
25-
nuget FSharp.Core
25+
nuget FSharp.Core = 4.5.2
2626
nuget Microsoft.Data.SqlClient
2727

2828
group DesignTime
2929
source https://www.nuget.org/api/v2/
3030
framework: >= netcoreapp2.2
3131
storage: none
3232

33+
nuget FSharp.Core = 4.5.2
3334
nuget System.Configuration.ConfigurationManager
3435
nuget System.Data.Common
3536
nuget System.Runtime.Caching
36-
nuget FSharp.Core
3737
nuget Microsoft.Data.SqlClient
3838
nuget Microsoft.SqlServer.TransactSql.ScriptDom 150.4897.1
3939
#nuget Microsoft.SqlServer.Types

paket.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ STORAGE: NONE
2727
RESTRICTION: >= netcoreapp2.2
2828
NUGET
2929
remote: https://www.nuget.org/api/v2
30-
FSharp.Core (5.0.1)
30+
FSharp.Core (4.5.2)
3131
Microsoft.CSharp (4.7) - restriction: || (&& (>= net45) (>= netcoreapp2.2) (< netstandard2.0)) (&& (>= net46) (>= netcoreapp2.2)) (&& (>= net461) (>= netcoreapp2.2)) (&& (< netcoreapp2.1) (>= netcoreapp2.2) (>= netstandard2.1)) (&& (>= netcoreapp2.2) (< netstandard2.1)) (&& (>= netcoreapp2.2) (>= uap10.0)) (>= netcoreapp3.1)
3232
Microsoft.Data.SqlClient (2.1.2)
3333
Microsoft.Data.SqlClient.SNI.runtime (>= 2.1.1) - restriction: || (&& (< netcoreapp2.1) (>= netcoreapp2.2) (>= netstandard2.1)) (&& (>= netcoreapp2.2) (< netstandard2.1)) (>= netcoreapp3.1)
@@ -638,7 +638,7 @@ GROUP Library
638638
RESTRICTION: >= netstandard2.0
639639
NUGET
640640
remote: https://www.nuget.org/api/v2
641-
FSharp.Core (5.0.1)
641+
FSharp.Core (4.5.2)
642642
Microsoft.CSharp (4.7) - restriction: || (&& (>= net45) (>= netcoreapp2.1) (< netstandard2.0)) (&& (>= net45) (< netstandard2.0) (>= netstandard2.1)) (&& (< net45) (>= net46) (>= netstandard2.0)) (&& (< net45) (>= net461) (>= netstandard2.0)) (&& (< net45) (< netcoreapp2.1) (>= netstandard2.0) (< netstandard2.1)) (&& (>= net46) (>= xamarinios)) (&& (>= net461) (>= netcoreapp2.1)) (&& (>= net461) (>= netstandard2.1)) (&& (>= netcoreapp2.1) (< netstandard2.1)) (&& (>= netcoreapp2.1) (>= uap10.0)) (&& (< netcoreapp2.1) (>= netstandard2.1)) (&& (< netcoreapp2.1) (< netstandard2.1) (>= xamarinios)) (>= netcoreapp3.1) (&& (>= netstandard2.0) (>= uap10.0)) (&& (>= netstandard2.1) (>= uap10.0))
643643
Microsoft.Data.SqlClient (2.1.2)
644644
Microsoft.Data.SqlClient.SNI (>= 2.1.1) - restriction: && (>= net46) (>= netstandard2.0)

src/SqlClient.DesignTime/SqlClient.DesignTime.fsproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,16 @@
4343
<None Include="Scripts\ReverseLineOrderForNotex.fsx" />
4444
<None Include="Scripts\XE.fsx" />
4545
</ItemGroup>
46-
46+
4747
<Target Name="CopyAssembliesToTPFolder" AfterTargets="Build">
4848
<ItemGroup>
4949
<DesignTimeAssemblies Include="$(OutputPath)\FSharp.Data.SqlClient.DesignTime.*" />
5050
<DesignTimeAssemblies Include="$(OutputPath)\Microsoft.SqlServer.*.dll" />
51+
<DesignTimeAssemblies Include="$(OutputPath)\Microsoft.Data.SqlClient.*" />
52+
<DesignTimeAssemblies Include="$(OutputPath)\System.Configuration.ConfigurationManager.*" />
5153
</ItemGroup>
5254
<Copy SourceFiles="@(DesignTimeAssemblies)" DestinationFolder="..\..\bin\typeproviders\fsharp41\$(TargetFramework)" />
5355
</Target>
54-
56+
5557
<Import Project="..\..\.paket\Paket.Restore.targets" />
5658
</Project>

src/SqlClient.DesignTime/paket.references

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
group DesignTime
22

3+
FSharp.Core
34
System.Configuration.ConfigurationManager
45
System.Data.Common
56
System.Runtime.Caching

0 commit comments

Comments
 (0)