summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20201221203824_create_hashtags_objects.exs
blob: 34049549f039d82d514290f04b59713fe2add664 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only

defmodule Pleroma.Repo.Migrations.CreateHashtagsObjects do
  use Ecto.Migration

  def change do
    create_if_not_exists table(:hashtags_objects, primary_key: false) do
      add(:hashtag_id, references(:hashtags), null: false, primary_key: true)
      add(:object_id, references(:objects), null: false, primary_key: true)
    end

    # Note: PK index: "hashtags_objects_pkey" PRIMARY KEY, btree (hashtag_id, object_id)
    create_if_not_exists(index(:hashtags_objects, [:object_id]))
  end
end