aboutsummaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2019-12-04 09:34:44 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2019-12-04 09:34:44 +0300
commit29a98b86b7056540ed4102a83dfe6a7e809c2519 (patch)
tree559c763669b1f647f96ff9fa67e36343da87565f /priv
parent652cc6ba4b7a0494cc96ef4a9bfcaa3b5e5be60e (diff)
parent7722e5a67a46304f3ae0e37f674a44ca9268be5e (diff)
downloadpleroma-29a98b86b7056540ed4102a83dfe6a7e809c2519.tar.gz
Merge branch 'develop' into issue/1383
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20191025081729_add_move_support_to_users.exs10
-rw-r--r--priv/repo/migrations/20191123103423_remove_info_from_users.exs9
-rw-r--r--priv/repo/migrations/20191128153944_fix_missing_following_count.exs53
-rw-r--r--priv/static/schemas/litepub-0.1.jsonld6
4 files changed, 77 insertions, 1 deletions
diff --git a/priv/repo/migrations/20191025081729_add_move_support_to_users.exs b/priv/repo/migrations/20191025081729_add_move_support_to_users.exs
new file mode 100644
index 000000000..580b9eb0f
--- /dev/null
+++ b/priv/repo/migrations/20191025081729_add_move_support_to_users.exs
@@ -0,0 +1,10 @@
+defmodule Pleroma.Repo.Migrations.AddMoveSupportToUsers do
+ use Ecto.Migration
+
+ def change do
+ alter table(:users) do
+ add(:also_known_as, {:array, :string}, default: [], null: false)
+ add(:allow_following_move, :boolean, default: true, null: false)
+ end
+ end
+end
diff --git a/priv/repo/migrations/20191123103423_remove_info_from_users.exs b/priv/repo/migrations/20191123103423_remove_info_from_users.exs
new file mode 100644
index 000000000..b251255ea
--- /dev/null
+++ b/priv/repo/migrations/20191123103423_remove_info_from_users.exs
@@ -0,0 +1,9 @@
+defmodule Pleroma.Repo.Migrations.RemoveInfoFromUsers do
+ use Ecto.Migration
+
+ def change do
+ alter table(:users) do
+ remove(:info, :map, default: %{})
+ end
+ end
+end
diff --git a/priv/repo/migrations/20191128153944_fix_missing_following_count.exs b/priv/repo/migrations/20191128153944_fix_missing_following_count.exs
new file mode 100644
index 000000000..3236de7a4
--- /dev/null
+++ b/priv/repo/migrations/20191128153944_fix_missing_following_count.exs
@@ -0,0 +1,53 @@
+defmodule Pleroma.Repo.Migrations.FixMissingFollowingCount do
+ use Ecto.Migration
+
+ def up do
+ """
+ UPDATE
+ users
+ SET
+ following_count = sub.count
+ FROM
+ (
+ SELECT
+ users.id AS sub_id
+ ,COUNT (following_relationships.id)
+ FROM
+ following_relationships
+ ,users
+ WHERE
+ users.id = following_relationships.follower_id
+ AND following_relationships.state = 'accept'
+ GROUP BY
+ users.id
+ ) AS sub
+ WHERE
+ users.id = sub.sub_id
+ AND users.local = TRUE
+ ;
+ """
+ |> execute()
+
+ """
+ UPDATE
+ users
+ SET
+ following_count = 0
+ WHERE
+ following_count IS NULL
+ """
+ |> execute()
+
+ execute("ALTER TABLE users
+ ALTER COLUMN following_count SET DEFAULT 0,
+ ALTER COLUMN following_count SET NOT NULL
+ ")
+ end
+
+ def down do
+ execute("ALTER TABLE users
+ ALTER COLUMN following_count DROP DEFAULT,
+ ALTER COLUMN following_count DROP NOT NULL
+ ")
+ end
+end
diff --git a/priv/static/schemas/litepub-0.1.jsonld b/priv/static/schemas/litepub-0.1.jsonld
index 8bae42f6d..e7ebf72be 100644
--- a/priv/static/schemas/litepub-0.1.jsonld
+++ b/priv/static/schemas/litepub-0.1.jsonld
@@ -29,7 +29,11 @@
"@id": "litepub:oauthRegistrationEndpoint",
"@type": "@id"
},
- "EmojiReaction": "litepub:EmojiReaction"
+ "EmojiReaction": "litepub:EmojiReaction",
+ "alsoKnownAs": {
+ "@id": "as:alsoKnownAs",
+ "@type": "@id"
+ }
}
]
}