Improved static database setup.

This commit is contained in:
Achim D. Brucker 2017-06-27 10:54:12 +01:00
parent 321b9e9c38
commit c0065af78f
1 changed files with 15 additions and 10 deletions

View File

@ -1,19 +1,25 @@
// reference the type provider dll
#r "./packages/SQLProvider/lib/FSharp.Data.SqlProvider.dll"
open FSharp.Data.Sql
#r @"Mono.Data.Sqlite.dll"
#r @"./packages/SQLProvider/lib/FSharp.Data.SqlProvider.dll"
open FSharp.Data.Sql
open System.IO
let (+/) path1 path2 = Path.Combine(path1, path2)
let [<Literal>] DevelopmentDB = "aa-ac.sqlite"
let [<Literal>] FullDB = "full.sqlite"
let [<Literal>] DatabaseDir = "archive/db"
// static (compile time) ResolutionPath and ConnectionString
let [<Literal>] ResolutionPath = __SOURCE_DIRECTORY__ + @"/lib"
let [<Literal>] ConnectionString = "Data Source="
+ __SOURCE_DIRECTORY__ + @"/data/extensions.sqlite;Version=3"
let [<Literal>] ConnectionString = @"Data Source="
+ __SOURCE_DIRECTORY__
+ @"/" + DatabaseDir
+ @"/" + DevelopmentDB + @";Version=3"
// create a type alias with the connection string and database vendor settings
type Sql = SqlDataProvider<
ConnectionString = ConnectionString,
DatabaseVendor = Common.DatabaseProviderTypes.SQLITE,
ResolutionPath = ResolutionPath,
// ResolutionPath = ResolutionPath,
IndividualsAmount = 500,
UseOptionTypes = true >
@ -28,7 +34,7 @@ let getDownloads extid = query {
download.Value))
|> Seq.toArray
let customers =
let exts =
Ctx.Main.Extension
|> Seq.map(fun c -> c.Extid)
|> Seq.toList
@ -54,4 +60,3 @@ let ExtIds = ["aaagbdompnfgjaokopkpaceijcapjdde"
|> Chart.WithOptions (Options(legend=Legend(position="bottom")))
|> Chart.WithLabels ExtIds