Skip to content

Commit 5151a09

Browse files
committed
add transform for GithubInstallation
1 parent d7f2cd6 commit 5151a09

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

scripts/database_migration.exs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ defmodule DatabaseMigration do
3838
"Reward" => nil,
3939
"Claim" => "claims",
4040
"BountyCharge" => "transactions",
41-
"BountyTransfer" => "transactions"
41+
"BountyTransfer" => "transactions",
42+
"GithubInstallation" => "installations"
4243
}
4344

4445
@schema_mappings %{
@@ -52,10 +53,11 @@ defmodule DatabaseMigration do
5253
"Reward" => nil,
5354
"Claim" => Claim,
5455
"BountyCharge" => Transaction,
55-
"BountyTransfer" => Transaction
56+
"BountyTransfer" => Transaction,
57+
"GithubInstallation" => Installation
5658
}
5759

58-
@backfilled_tables ["repositories", "transactions", "bounties", "tickets", "users"]
60+
@backfilled_tables ["installations", "repositories", "transactions", "claims", "bounties", "tickets", "users"]
5961

6062
@relevant_tables Map.keys(@table_mappings)
6163

@@ -421,6 +423,22 @@ defmodule DatabaseMigration do
421423
}
422424
end
423425

426+
defp transform("GithubInstallation", row, _db) do
427+
%{
428+
"id" => row["id"],
429+
"provider" => "github",
430+
"provider_id" => row["github_id"],
431+
"provider_meta" => nil,
432+
"avatar_url" => nil,
433+
"repository_selection" => nil,
434+
"owner_id" => nil,
435+
"connected_user_id" => nil,
436+
"inserted_at" => row["created_at"],
437+
"updated_at" => row["updated_at"],
438+
"provider_user_id" => nil
439+
}
440+
end
441+
424442
defp transform(_, _row, _db), do: nil
425443

426444
def process_dump(input_file, output_file) do

0 commit comments

Comments
 (0)