Fix migration issues
v2 is deployed
This commit is contained in:
parent
7f34b72cc0
commit
f9d3b98c9e
|
@ -66,7 +66,13 @@ let migrateRequests (store : IDocumentStore) connStr =
|
||||||
use rdr = cmd.ExecuteReader ()
|
use rdr = cmd.ExecuteReader ()
|
||||||
while rdr.Read () do
|
while rdr.Read () do
|
||||||
let reqId = rdr.getString "requestId"
|
let reqId = rdr.getString "requestId"
|
||||||
let recurrence = (rdr.getString >> Recurrence.fromString) "recurType"
|
let recurrence =
|
||||||
|
match rdr.getString "recurType" with
|
||||||
|
| "immediate" -> Immediate
|
||||||
|
| "hours" -> Hours
|
||||||
|
| "days" -> Days
|
||||||
|
| "weeks" -> Weeks
|
||||||
|
| x -> invalidOp (sprintf "%s is not a valid recurrence" x)
|
||||||
sess.Store (
|
sess.Store (
|
||||||
{ Id = (RequestId.fromIdString >> RequestId.toString) reqId
|
{ Id = (RequestId.fromIdString >> RequestId.toString) reqId
|
||||||
enteredOn = rdr.getTicks "enteredOn"
|
enteredOn = rdr.getTicks "enteredOn"
|
||||||
|
@ -81,17 +87,24 @@ let migrateRequests (store : IDocumentStore) connStr =
|
||||||
sess.SaveChanges ()
|
sess.SaveChanges ()
|
||||||
|
|
||||||
open Converters
|
open Converters
|
||||||
|
open System
|
||||||
|
open System.Security.Cryptography.X509Certificates
|
||||||
|
|
||||||
[<EntryPoint>]
|
[<EntryPoint>]
|
||||||
let main argv =
|
let main argv =
|
||||||
let raven = new DocumentStore (Urls = [| argv.[0] |], Database = "myPrayerJournal")
|
match argv.Length with
|
||||||
raven.Conventions.CustomizeJsonSerializer <-
|
| 4 ->
|
||||||
fun x ->
|
let clientCert = new X509Certificate2 (argv.[1], argv.[2])
|
||||||
x.Converters.Add (RequestIdJsonConverter ())
|
let raven = new DocumentStore (Urls = [| argv.[0] |], Database = "myPrayerJournal", Certificate = clientCert)
|
||||||
x.Converters.Add (TicksJsonConverter ())
|
raven.Conventions.CustomizeJsonSerializer <-
|
||||||
x.Converters.Add (UserIdJsonConverter ())
|
fun x ->
|
||||||
x.Converters.Add (CompactUnionJsonConverter ())
|
x.Converters.Add (RequestIdJsonConverter ())
|
||||||
let store = raven.Initialize ()
|
x.Converters.Add (TicksJsonConverter ())
|
||||||
migrateRequests store argv.[1]
|
x.Converters.Add (UserIdJsonConverter ())
|
||||||
printfn "fin"
|
x.Converters.Add (CompactUnionJsonConverter ())
|
||||||
0 // return an integer exit code
|
let store = raven.Initialize ()
|
||||||
|
migrateRequests store argv.[3]
|
||||||
|
printfn "fin"
|
||||||
|
| _ ->
|
||||||
|
Console.WriteLine "Usage: dotnet migrate.dll [raven-url] [raven-cert-file] [raven-cert-pw] [postgres-conn-str]"
|
||||||
|
0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user