forked from fsprojects/Rezoom.SQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefaultBackend.fs
More file actions
42 lines (39 loc) · 1.44 KB
/
DefaultBackend.fs
File metadata and controls
42 lines (39 loc) · 1.44 KB
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
40
41
42
namespace Rezoom.SQL.Compiler
open System
open System.Data
open System.Collections.Generic
open System.Globalization
open Rezoom.SQL.Compiler
open Rezoom.SQL.Compiler.BackendUtilities
open Rezoom.SQL.Compiler.Translators
open Rezoom.SQL.Mapping
open Rezoom.SQL.Migrations
type DefaultBackend() =
static let initialModel =
let main, temp = Name("main"), Name("temp")
{ Schemas =
[ Schema.Empty(main)
Schema.Empty(temp)
] |> List.map (fun s -> s.SchemaName, s) |> Map.ofList
DefaultSchema = main
TemporarySchema = temp
Builtin =
{ Functions = DefaultFunctions.extendedBy [||]
}
BackendCharacteristics =
{ CanDropColumnWithDefaultValue = true
}
}
interface IBackend with
member this.MigrationBackend =
<@ fun settings ->
new DefaultMigrationBackend(settings) :> IMigrationBackend
@>
member this.InitialModel = initialModel
member this.ParameterTransform(columnType) = ParameterTransform.Default(columnType)
member this.ToCommandFragments(indexer, stmts) =
let translator = DefaultStatementTranslator(Name("RZSQL"), indexer)
translator.TotalStatements(stmts)
|> BackendUtilities.simplifyFragments
|> ResizeArray
:> _ IReadOnlyList