objective categorical abstract machine language personal data server
65
fork

Configure Feed

Select the types of activity you want to include in your feed.

Run migrations on every db connection

futurGH 978abd6e fd846cc6

+7 -9
-2
bin/main.ml
··· 200 200 let serve () = 201 201 Printexc.record_backtrace true ; 202 202 let%lwt db = Data_store.connect ~create:true () in 203 - let%lwt () = Data_store.init db in 204 203 S3.Backup.start () ; 205 204 Dream.serve ~interface:"0.0.0.0" ~port:8008 206 205 @@ Dream.pipeline ··· 221 220 222 221 let create_invite ?(uses = 1) () = 223 222 let%lwt db = Data_store.connect ~create:true () in 224 - let%lwt () = Data_store.init db in 225 223 let%lwt code = 226 224 Api.Server.CreateInviteCode.create_invite_code ~db ~did:"admin" 227 225 ~use_count:uses
+5 -3
pegasus/lib/data_store.ml
··· 321 321 let connect ?create ?write () : t Lwt.t = 322 322 if create = Some true then 323 323 Util.mkfile_p Util.Constants.pegasus_db_filepath ~perm:0o644 ; 324 - Util.connect_sqlite ?create ?write Util.Constants.pegasus_db_location 325 - 326 - let init conn : unit Lwt.t = Migrations.run_migrations Data_store conn 324 + let%lwt db = 325 + Util.connect_sqlite ?create ?write Util.Constants.pegasus_db_location 326 + in 327 + let%lwt () = Migrations.run_migrations Data_store db in 328 + Lwt.return db 327 329 328 330 let create_actor ~did ~handle ~email ~password ~signing_key conn = 329 331 let password_hash = Bcrypt.hash password |> Bcrypt.string_of_hash in
-1
pegasus/lib/repository.ml
··· 464 464 Errors.invalid_request ~name:"RepoNotFound" 465 465 "your princess is in another castle" 466 466 in 467 - let%lwt () = User_store.init user_db in 468 467 let%lwt {signing_key; _} = 469 468 match%lwt Data_store.get_actor_by_identifier did data_store_conn with 470 469 | Some actor when ensure_active = false || actor.deactivated_at = None ->
+1 -2
pegasus/lib/user_store.ml
··· 305 305 let%lwt db = 306 306 Util.connect_sqlite ?create ?write (Util.Constants.user_db_location did) 307 307 in 308 + let%lwt () = Migrations.run_migrations User_store db in 308 309 Lwt.return {did; db} 309 - 310 - let init t : unit Lwt.t = Migrations.run_migrations User_store t.db 311 310 312 311 (* mst blocks; implements Writable_blockstore *) 313 312
+1 -1
pegasus/test/test_sequencer.ml
··· 27 27 Util.connect_sqlite ~create:true ~write:true 28 28 (Uri.of_string ("sqlite3://" ^ tmp)) 29 29 in 30 - let%lwt () = Data_store.init pool in 30 + let%lwt () = Migrations.run_migrations Data_store pool in 31 31 let%lwt () = f pool in 32 32 Lwt.return () 33 33