Fixup old migrations.
authorRoger Braun <roger@rogerbraun.net>
Sat, 16 Sep 2017 22:01:49 +0000 (00:01 +0200)
committerRoger Braun <roger@rogerbraun.net>
Sat, 16 Sep 2017 22:01:49 +0000 (00:01 +0200)
priv/repo/migrations/20170501124823_add_id_contraints_to_activities_and_objects.exs
priv/repo/migrations/20170501133231_add_id_contraints_to_activities_and_objects_part_two.exs
priv/repo/migrations/20170620133028_add_object_activity_index.exs
priv/repo/migrations/20170620142420_add_object_activity_index_part_two.exs
priv/repo/migrations/20170719152213_add_follower_address_to_user.exs

index 21534adc7895353a004aa4443409054f9e5c3720..cebaa7c4e40ae06bda951c5e79d2cd7d3866611c 100644 (file)
@@ -2,7 +2,8 @@ defmodule Pleroma.Repo.Migrations.AddIdContraintsToActivitiesAndObjects do
   use Ecto.Migration
 
   def change do
-    create index(:objects, ["(data->>\"id\")"], name: :objects_unique_apid_index)
-    create index(:activities, ["(data->>\"id\")"], name: :activities_unique_apid_index)
+    # This was wrong, make it a noop.
+    # create index(:objects, ["(data->>\"id\")"], name: :objects_unique_apid_index)
+    # create index(:activities, ["(data->>\"id\")"], name: :activities_unique_apid_index)
   end
 end
index 12eea136923b23924d34a5548e1fb34fc3b9fd78..1472b60b4cd8a369e3083e834d297918716677ae 100644 (file)
@@ -2,8 +2,8 @@ defmodule Pleroma.Repo.Migrations.AddIdContraintsToActivitiesAndObjectsPartTwo d
   use Ecto.Migration
 
   def change do
-    drop index(:objects, ["(data->>\"id\")"], name: :objects_unique_apid_index)
-    drop index(:activities, ["(data->>\"id\")"], name: :activities_unique_apid_index)
+    drop_if_exists index(:objects, ["(data->>\"id\")"], name: :objects_unique_apid_index)
+    drop_if_exists index(:activities, ["(data->>\"id\")"], name: :activities_unique_apid_index)
     create unique_index(:objects, ["(data->>'id')"], name: :objects_unique_apid_index)
     create unique_index(:activities, ["(data->>'id')"], name: :activities_unique_apid_index)
   end
index 1abbd78027535292bcdce60a12b53468f38a4ec0..df0b8391e50e544cd94ae6d7506984a082d71004 100644 (file)
@@ -2,6 +2,7 @@ defmodule Pleroma.Repo.Migrations.AddObjectActivityIndex do
   use Ecto.Migration
 
   def change do
-    create index(:objects, ["(data->'object'->>'id')", "(data->>'type')"], name: :activities_create_objects_index)
+    # This was wrong, now a noop
+    # create index(:objects, ["(data->'object'->>'id')", "(data->>'type')"], name: :activities_create_objects_index)
   end
 end
index 705a05f822a152a28667f40cbdf434cd54a7cb1e..8d5a95c45e9707b2b1333ba20db9bec3db8a5b38 100644 (file)
@@ -2,7 +2,7 @@ defmodule Pleroma.Repo.Migrations.AddObjectActivityIndexPartTwo do
   use Ecto.Migration
 
   def change do
-    drop index(:objects, ["(data->'object'->>'id')", "(data->>'type')"], name: :activities_create_objects_index)
+    drop_if_exists index(:objects, ["(data->'object'->>'id')", "(data->>'type')"], name: :activities_create_objects_index)
     create index(:activities, ["(data->'object'->>'id')", "(data->>'type')"], name: :activities_create_objects_index)
   end
 end
index bd3c93bd5105511b215cc383f4df4eb4a929056b..4d163ce0b8e920d62fb384cd566eb800d6a67a0f 100644 (file)
@@ -8,21 +8,23 @@ defmodule Pleroma.Repo.Migrations.AddFollowerAddressToUser do
     alter table(:users) do
       add :follower_address, :string, unique: true
     end
-    flush()
 
-    children = [
-      # Start the endpoint when the application starts
-      supervisor(Pleroma.Web.Endpoint, [])
-    ]
-    opts = [strategy: :one_for_one, name: Pleroma.Supervisor]
-    Supervisor.start_link(children, opts)
+    # Not needed anymore for new setups.
+    # flush()
 
-    Enum.each(Repo.all(User), fn (user) ->
-      if !user.follower_address do
-        cs = Ecto.Changeset.change(user, %{follower_address: User.ap_followers(user)})
-        Repo.update!(cs)
-      end
-    end)
+    # children = [
+    #   # Start the endpoint when the application starts
+    #   supervisor(Pleroma.Web.Endpoint, [])
+    # ]
+    # opts = [strategy: :one_for_one, name: Pleroma.Supervisor]
+    # Supervisor.start_link(children, opts)
+
+    # Enum.each(Repo.all(User), fn (user) ->
+    #   if !user.follower_address do
+    #     cs = Ecto.Changeset.change(user, %{follower_address: User.ap_followers(user)})
+    #     Repo.update!(cs)
+    #   end
+    # end)
   end
 
   def down do