diff --git a/priv/ingest_repo/migrations/20241216133031_add_scroll_depth_to_imported_pages.exs b/priv/ingest_repo/migrations/20241216133031_add_scroll_depth_to_imported_pages.exs index d3a50e5dd7b5..bac6c85f9e43 100644 --- a/priv/ingest_repo/migrations/20241216133031_add_scroll_depth_to_imported_pages.exs +++ b/priv/ingest_repo/migrations/20241216133031_add_scroll_depth_to_imported_pages.exs @@ -15,7 +15,7 @@ defmodule Plausible.IngestRepo.Migrations.AddScrollDepthToImportedPages do execute """ ALTER TABLE imported_pages #{@on_cluster} - DROP COLUMN scroll_depth + DROP COLUMN IF EXISTS scroll_depth """ end end diff --git a/priv/ingest_repo/migrations/20241218102326_drop_and_add_scroll_depth_to_imported_pages.exs b/priv/ingest_repo/migrations/20241218102326_drop_and_add_scroll_depth_to_imported_pages.exs new file mode 100644 index 000000000000..49db29021909 --- /dev/null +++ b/priv/ingest_repo/migrations/20241218102326_drop_and_add_scroll_depth_to_imported_pages.exs @@ -0,0 +1,27 @@ +defmodule Plausible.IngestRepo.Migrations.DropAndAddScrollDepthToImportedPages do + use Ecto.Migration + + @on_cluster Plausible.MigrationUtils.on_cluster_statement("imported_pages") + + def up do + execute """ + ALTER TABLE imported_pages + #{@on_cluster} + DROP COLUMN scroll_depth + """ + + execute """ + ALTER TABLE imported_pages + #{@on_cluster} + ADD COLUMN scroll_depth Nullable(UInt64) + """ + end + + def down do + execute """ + ALTER TABLE imported_pages + #{@on_cluster} + DROP COLUMN scroll_depth + """ + end +end