@@ -30,6 +30,7 @@ defmodule DatabaseMigration do
30
30
alias Algora.Payments.Customer
31
31
alias Algora.Payments.PaymentMethod
32
32
alias Algora.Payments.Transaction
33
+ alias Algora.Workspace.CommandResponse
33
34
alias Algora.Workspace.Installation
34
35
alias Algora.Workspace.Ticket
35
36
@@ -45,6 +46,7 @@ defmodule DatabaseMigration do
45
46
{ "GithubIssue" , nil } ,
46
47
{ "GithubPullRequest" , nil } ,
47
48
{ "Bounty" , Bounty } ,
49
+ { "Bounty" , CommandResponse } ,
48
50
{ "Reward" , nil } ,
49
51
{ "Attempt" , Attempt } ,
50
52
{ "Claim" , Claim } ,
@@ -338,6 +340,23 @@ defmodule DatabaseMigration do
338
340
}
339
341
end
340
342
343
+ defp transform ( { "Bounty" , CommandResponse } , row , _db ) do
344
+ if row [ "github_res_comment_id" ] != nil do
345
+ % {
346
+ "id" => row [ "id" ] ,
347
+ "provider" => "github" ,
348
+ "provider_meta" => nil ,
349
+ "provider_command_id" => row [ "github_req_comment_id" ] ,
350
+ "provider_response_id" => row [ "github_res_comment_id" ] ,
351
+ "command_source" => "comment" ,
352
+ "command_type" => "bounty" ,
353
+ "ticket_id" => row [ "task_id" ] ,
354
+ "inserted_at" => row [ "created_at" ] ,
355
+ "updated_at" => row [ "updated_at" ]
356
+ }
357
+ end
358
+ end
359
+
341
360
defp transform ( { "Attempt" , Attempt } , row , db ) do
342
361
bounty = db |> Map . get ( "Bounty" , [ ] ) |> Enum . find ( & ( & 1 [ "id" ] == row [ "bounty_id" ] ) )
343
362
@@ -740,7 +759,7 @@ defmodule DatabaseMigration do
740
759
|> Map . take ( Enum . map ( Map . keys ( default_fields ) , & Atom . to_string / 1 ) )
741
760
|> Map . new ( fn { k , v } -> { String . to_existing_atom ( k ) , v } end )
742
761
743
- # Ensure handle is unique
762
+ # TODO: do we need this?
744
763
fields = ensure_unique_handle ( fields )
745
764
746
765
Map . merge ( default_fields , fields )
0 commit comments