First
[anni] / priv / repo / migrations / 20201221203824_create_hashtags_objects.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Repo.Migrations.CreateHashtagsObjects do
6   use Ecto.Migration
7
8   def change do
9     create_if_not_exists table(:hashtags_objects, primary_key: false) do
10       add(:hashtag_id, references(:hashtags), null: false, primary_key: true)
11       add(:object_id, references(:objects), null: false, primary_key: true)
12     end
13
14     # Note: PK index: "hashtags_objects_pkey" PRIMARY KEY, btree (hashtag_id, object_id)
15     create_if_not_exists(index(:hashtags_objects, [:object_id]))
16   end
17 end