Skip to content

Commit

Permalink
Redo migration: Add scroll_depth to imported_pages (plausible#4926)
Browse files Browse the repository at this point in the history
* add migration

* rename migration file and change column type to Nullable(UInt64)
  • Loading branch information
RobertJoonas authored Dec 19, 2024
1 parent f4f4d70 commit 27422f0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 27422f0

Please sign in to comment.