X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=priv%2Frepo%2Fmigrations%2F20181218172826_users_and_activities_flake_id.exs;h=a5b4c543da9625f6dc5b2a09c3b6b6f3338bfbeb;hb=85c7916c94017c6a3657a3540f1e6c3afcb78225;hp=848d507e581cffbf0959726c9b0c29f6c601fb4d;hpb=9ba6e1fabed3a583ba09c730efb144939a3a15a8;p=akkoma diff --git a/priv/repo/migrations/20181218172826_users_and_activities_flake_id.exs b/priv/repo/migrations/20181218172826_users_and_activities_flake_id.exs index 848d507e5..a5b4c543d 100644 --- a/priv/repo/migrations/20181218172826_users_and_activities_flake_id.exs +++ b/priv/repo/migrations/20181218172826_users_and_activities_flake_id.exs @@ -12,7 +12,7 @@ defmodule Pleroma.Repo.Migrations.UsersAndActivitiesFlakeId do # 4- update relation pkeys with the new ids # 5- rename the temporary column to id # 6- re-create the constraints - def change do + def up do # Old serial int ids are transformed to 128bits with extra padding. # The application (in `Pleroma.FlakeId`) handles theses IDs properly as integers; to keep compatibility # with previously issued ids. @@ -70,16 +70,20 @@ defmodule Pleroma.Repo.Migrations.UsersAndActivitiesFlakeId do """ end + flush() + stop_clippy_heartbeats(clippy) end + def down, do: :ok + defp start_clippy_heartbeats() do count = from(a in "activities", select: count(a.id)) |> Repo.one! - pid = if count > 5000 do + if count > 5000 do heartbeat_interval = :timer.minutes(2) + :timer.seconds(30) all_tips = Clippy.tips() ++ [ - "The migration is still running, maybe it's time for another tea?", + "The migration is still running, maybe it's time for another “tea”?", "Happy rabbits practice a cute behavior known as a\n“binky:” they jump up in the air\nand twist\nand spin around!", "Nothing and everything.\n\nI still work.", "Pleroma runs on a Raspberry Pi!\n\n … but this migration will take forever if you\nactually run on a raspberry pi", @@ -104,7 +108,7 @@ defmodule Pleroma.Repo.Migrations.UsersAndActivitiesFlakeId do [:red, :bright, "It looks like you are running an older instance!"], [""], [:bright, "This migration may take a long time", :reset, " -- so you probably should"], - ["go drink a coffee, or a tea, or a beer, a whiskey, a vodka,"], + ["go drink a cofe, or a tea, or a beer, a whiskey, a vodka,"], ["while it runs to deal with your temporary fediverse pause!"] ] :timer.sleep(heartbeat_interval)