mirror of
https://github.com/plausible/analytics.git
synced 2024-12-22 17:11:36 +03:00
- migration is irreversible for now, likely due to https://github.com/plausible/ecto_ch/issues/81#issuecomment-1624754909 or maybe https://github.com/plausible/ecto_ch/pull/58/files - IO.inspect call removed
This commit is contained in:
parent
ff66e9b1e4
commit
52d5fac362
@ -2,33 +2,34 @@ defmodule Plausible.IngestRepo.Migrations.DisableDeduplicationWindowForImports d
|
||||
use Ecto.Migration
|
||||
|
||||
@import_tables ~w(
|
||||
imported_visitors
|
||||
imported_sources
|
||||
imported_pages
|
||||
imported_entry_pages
|
||||
imported_exit_pages
|
||||
imported_locations
|
||||
imported_devices
|
||||
imported_browsers
|
||||
imported_visitors
|
||||
imported_sources
|
||||
imported_pages
|
||||
imported_entry_pages
|
||||
imported_exit_pages
|
||||
imported_locations
|
||||
imported_devices
|
||||
imported_browsers
|
||||
imported_operating_systems
|
||||
)
|
||||
|
||||
def change do
|
||||
def up do
|
||||
cluster_query = "SELECT 1 FROM system.replicas WHERE table = 'imported_visitors'"
|
||||
|
||||
cluster? =
|
||||
case Ecto.Adapters.SQL.query(Plausible.IngestRepo, cluster_query) |> IO.inspect() do
|
||||
case Ecto.Adapters.SQL.query(Plausible.IngestRepo, cluster_query) do
|
||||
{:ok, %{rows: []}} -> false
|
||||
{:ok, _} -> true
|
||||
end
|
||||
|
||||
for table <- @import_tables do
|
||||
execute """
|
||||
ALTER TABLE #{table} #{if cluster?, do: "ON CLUSTER '{cluster}'"} MODIFY SETTING replicated_deduplication_window = 0
|
||||
""",
|
||||
"""
|
||||
ALTER TABLE #{table} #{if cluster?, do: "ON CLUSTER '{cluster}'"} MODIFY SETTING replicated_deduplication_window = 100
|
||||
"""
|
||||
ALTER TABLE #{table} #{if cluster?, do: "ON CLUSTER '{cluster}'"} MODIFY SETTING replicated_deduplication_window = 0
|
||||
"""
|
||||
end
|
||||
end
|
||||
|
||||
def down do
|
||||
raise "Irreversible"
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user