summaryrefslogtreecommitdiff
path: root/priv/repo/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'priv/repo/migrations')
-rw-r--r--priv/repo/migrations/20170719152213_add_follower_address_to_user.exs20
-rw-r--r--priv/repo/migrations/20190518032627_create_config.exs13
-rw-r--r--priv/repo/migrations/20190525071417_add_non_follows_and_non_followers_fields_to_notification_settings.exs10
-rw-r--r--priv/repo/migrations/20190603115238_add_index_on_activities_local.exs7
-rw-r--r--priv/repo/migrations/20190603162018_add_object_in_reply_to_index.exs7
-rw-r--r--priv/repo/migrations/20190603173419_add_tag_index_to_objects.exs8
6 files changed, 45 insertions, 20 deletions
diff --git a/priv/repo/migrations/20170719152213_add_follower_address_to_user.exs b/priv/repo/migrations/20170719152213_add_follower_address_to_user.exs
index 4d163ce0b..591164be5 100644
--- a/priv/repo/migrations/20170719152213_add_follower_address_to_user.exs
+++ b/priv/repo/migrations/20170719152213_add_follower_address_to_user.exs
@@ -1,30 +1,10 @@
defmodule Pleroma.Repo.Migrations.AddFollowerAddressToUser do
use Ecto.Migration
- import Ecto.Query
- import Supervisor.Spec
- alias Pleroma.{Repo, User}
def up do
alter table(:users) do
add :follower_address, :string, unique: true
end
-
- # Not needed anymore for new setups.
- # 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)
-
- # 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
diff --git a/priv/repo/migrations/20190518032627_create_config.exs b/priv/repo/migrations/20190518032627_create_config.exs
new file mode 100644
index 000000000..1e4e3c689
--- /dev/null
+++ b/priv/repo/migrations/20190518032627_create_config.exs
@@ -0,0 +1,13 @@
+defmodule Pleroma.Repo.Migrations.CreateConfig do
+ use Ecto.Migration
+
+ def change do
+ create table(:config) do
+ add(:key, :string)
+ add(:value, :binary)
+ timestamps()
+ end
+
+ create(unique_index(:config, :key))
+ end
+end
diff --git a/priv/repo/migrations/20190525071417_add_non_follows_and_non_followers_fields_to_notification_settings.exs b/priv/repo/migrations/20190525071417_add_non_follows_and_non_followers_fields_to_notification_settings.exs
new file mode 100644
index 000000000..a88b0ea61
--- /dev/null
+++ b/priv/repo/migrations/20190525071417_add_non_follows_and_non_followers_fields_to_notification_settings.exs
@@ -0,0 +1,10 @@
+defmodule Pleroma.Repo.Migrations.AddNonFollowsAndNonFollowersFieldsToNotificationSettings do
+ use Ecto.Migration
+
+ def change do
+ execute("""
+ update users set info = jsonb_set(info, '{notification_settings}', '{"local": true, "remote": true, "follows": true, "followers": true, "non_follows": true, "non_followers": true}')
+ where local=true
+ """)
+ end
+end
diff --git a/priv/repo/migrations/20190603115238_add_index_on_activities_local.exs b/priv/repo/migrations/20190603115238_add_index_on_activities_local.exs
new file mode 100644
index 000000000..89daa9705
--- /dev/null
+++ b/priv/repo/migrations/20190603115238_add_index_on_activities_local.exs
@@ -0,0 +1,7 @@
+defmodule Pleroma.Repo.Migrations.AddIndexOnActivitiesLocal do
+ use Ecto.Migration
+
+ def change do
+ create(index("activities", [:local]))
+ end
+end
diff --git a/priv/repo/migrations/20190603162018_add_object_in_reply_to_index.exs b/priv/repo/migrations/20190603162018_add_object_in_reply_to_index.exs
new file mode 100644
index 000000000..df4ac7782
--- /dev/null
+++ b/priv/repo/migrations/20190603162018_add_object_in_reply_to_index.exs
@@ -0,0 +1,7 @@
+defmodule Pleroma.Repo.Migrations.AddObjectInReplyToIndex do
+ use Ecto.Migration
+
+ def change do
+ create index(:objects, ["(data->>'inReplyTo')"], name: :objects_in_reply_to_index)
+ end
+end
diff --git a/priv/repo/migrations/20190603173419_add_tag_index_to_objects.exs b/priv/repo/migrations/20190603173419_add_tag_index_to_objects.exs
new file mode 100644
index 000000000..c915a0213
--- /dev/null
+++ b/priv/repo/migrations/20190603173419_add_tag_index_to_objects.exs
@@ -0,0 +1,8 @@
+defmodule Pleroma.Repo.Migrations.AddTagIndexToObjects do
+ use Ecto.Migration
+
+ def change do
+ drop_if_exists index(:activities, ["(data #> '{\"object\",\"tag\"}')"], using: :gin, name: :activities_tags)
+ create index(:objects, ["(data->'tag')"], using: :gin, name: :objects_tags)
+ end
+end