File size: 618 Bytes
8da2481
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
defmodule Plausible.DataMigration.PostgresRepo do
  @moduledoc """
  Ecto.Repo for Posrtgres data migrations, to be started manually,
  outside of the main application supervision tree.
  """
  use Ecto.Repo,
    otp_app: :plausible,
    adapter: Ecto.Adapters.Postgres

  def start(url, opts \\ []) when is_binary(url) do
    default_config = Plausible.Repo.config()

    start_link(
      url: url,
      queue_target: 500,
      queue_interval: 2000,
      pool_size: opts[:pool_size] || 1,
      ssl: opts[:ssl] || default_config[:ssl],
      ssl_opts: opts[:ssl_opts] || default_config[:ssl_opts]
    )
  end
end