diff options
| author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-04-13 09:16:51 +0300 | 
|---|---|---|
| committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-04-13 09:16:51 +0300 | 
| commit | a21baf89d874823137cc49052cfe8da769ac0748 (patch) | |
| tree | 20ed514fe2b13beebf0221d844745252f7604c02 /priv/repo/migrations | |
| parent | dc2637c18880160286f50505b1140a58fdfdf7d1 (diff) | |
| parent | 7ee35eb9a6a55ef610eb02a04a33f67e5921cff3 (diff) | |
| download | pleroma-a21baf89d874823137cc49052cfe8da769ac0748.tar.gz pleroma-a21baf89d874823137cc49052cfe8da769ac0748.zip  | |
Merge remote-tracking branch 'remotes/origin/develop' into output-of-relationships-in-statuses
Diffstat (limited to 'priv/repo/migrations')
3 files changed, 51 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200328124805_change_following_relationships_state_to_integer.exs b/priv/repo/migrations/20200328124805_change_following_relationships_state_to_integer.exs new file mode 100644 index 000000000..2b0820f3f --- /dev/null +++ b/priv/repo/migrations/20200328124805_change_following_relationships_state_to_integer.exs @@ -0,0 +1,29 @@ +defmodule Pleroma.Repo.Migrations.ChangeFollowingRelationshipsStateToInteger do +  use Ecto.Migration + +  @alter_following_relationship_state "ALTER TABLE following_relationships ALTER COLUMN state" + +  def up do +    execute(""" +    #{@alter_following_relationship_state} TYPE integer USING +    CASE +      WHEN state = 'pending' THEN 1 +      WHEN state = 'accept' THEN 2 +      WHEN state = 'reject' THEN 3 +      ELSE 0 +    END; +    """) +  end + +  def down do +    execute(""" +    #{@alter_following_relationship_state} TYPE varchar(255) USING +    CASE +      WHEN state = 1 THEN 'pending' +      WHEN state = 2 THEN 'accept' +      WHEN state = 3 THEN 'reject' +      ELSE '' +    END; +    """) +  end +end diff --git a/priv/repo/migrations/20200328130139_add_following_relationships_following_id_index.exs b/priv/repo/migrations/20200328130139_add_following_relationships_following_id_index.exs new file mode 100644 index 000000000..884832f84 --- /dev/null +++ b/priv/repo/migrations/20200328130139_add_following_relationships_following_id_index.exs @@ -0,0 +1,11 @@ +defmodule Pleroma.Repo.Migrations.AddFollowingRelationshipsFollowingIdIndex do +  use Ecto.Migration + +  # [:follower_index] index is useless because of [:follower_id, :following_id] index +  # [:following_id] index makes sense because of user's followers-targeted queries +  def change do +    drop_if_exists(index(:following_relationships, [:follower_id])) + +    create_if_not_exists(index(:following_relationships, [:following_id])) +  end +end diff --git a/priv/repo/migrations/20200402063221_update_oban_jobs_table.exs b/priv/repo/migrations/20200402063221_update_oban_jobs_table.exs new file mode 100644 index 000000000..e7ff04008 --- /dev/null +++ b/priv/repo/migrations/20200402063221_update_oban_jobs_table.exs @@ -0,0 +1,11 @@ +defmodule Pleroma.Repo.Migrations.UpdateObanJobsTable do +  use Ecto.Migration + +  def up do +    Oban.Migrations.up(version: 8) +  end + +  def down do +    Oban.Migrations.down(version: 7) +  end +end  | 
