First
[anni] / priv / repo / migrations / 20190328053912_create_scheduled_activities.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.CreateScheduledActivities do
6   use Ecto.Migration
7
8   def change do
9     create_if_not_exists table(:scheduled_activities) do
10       add(:user_id, references(:users, type: :uuid, on_delete: :delete_all))
11       add(:scheduled_at, :naive_datetime, null: false)
12       add(:params, :map, null: false)
13
14       timestamps()
15     end
16
17     create_if_not_exists(index(:scheduled_activities, [:scheduled_at]))
18     create_if_not_exists(index(:scheduled_activities, [:user_id]))
19   end
20 end