Migration runs successfully
This commit is contained in:
parent
05394b4461
commit
2e5a1426f6
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BitBadger.Documents.Postgres" Version="4.0.1" />
|
<PackageReference Include="BitBadger.Documents.Postgres" Version="4.0.1" />
|
||||||
|
<PackageReference Include="Npgsql.NodaTime" Version="9.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -80,7 +80,9 @@ task {
|
|||||||
Configuration.useConnectionString (Environment.GetEnvironmentVariable "PT_SQLITE_CONN")
|
Configuration.useConnectionString (Environment.GetEnvironmentVariable "PT_SQLITE_CONN")
|
||||||
do! Connection.setUp ()
|
do! Connection.setUp ()
|
||||||
|
|
||||||
use source = NpgsqlDataSourceBuilder(Environment.GetEnvironmentVariable "PT_PG_CONN").Build()
|
let builder = NpgsqlDataSourceBuilder(Environment.GetEnvironmentVariable "PT_PG_CONN")
|
||||||
|
let _ = builder.UseNodaTime()
|
||||||
|
use source = builder.Build()
|
||||||
|
|
||||||
let! churches =
|
let! churches =
|
||||||
Sql.fromDataSource source
|
Sql.fromDataSource source
|
||||||
@ -122,8 +124,8 @@ task {
|
|||||||
for user in users do
|
for user in users do
|
||||||
let! groups =
|
let! groups =
|
||||||
Sql.fromDataSource source
|
Sql.fromDataSource source
|
||||||
|> Sql.query "SELECT small_group_id FROM pt.user_small_group WHERE user_id = :user_id"
|
|> Sql.query "SELECT small_group_id FROM pt.user_small_group WHERE user_id = @user_id"
|
||||||
|> Sql.parameters [ ":user_id", Sql.uuid user.Id.Value ]
|
|> Sql.parameters [ "@user_id", Sql.uuid user.Id.Value ]
|
||||||
|> Sql.executeAsync (fun row -> (row.uuid >> SmallGroupId) "small_group_id")
|
|> Sql.executeAsync (fun row -> (row.uuid >> SmallGroupId) "small_group_id")
|
||||||
do! Users.save { user with SmallGroups = groups }
|
do! Users.save { user with SmallGroups = groups }
|
||||||
printfn "Migrated %d users" users.Length
|
printfn "Migrated %d users" users.Length
|
||||||
|
0
src/PrayerTracker/data/.gitkeep
Normal file
0
src/PrayerTracker/data/.gitkeep
Normal file
Loading…
x
Reference in New Issue
Block a user