e3102f7646466a8e81751cf61bc00869115da8af
[anni] / priv / repo / migrations / 20200831192323_create_backups.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.CreateBackups do
6   use Ecto.Migration
7
8   def change do
9     create_if_not_exists table(:backups) do
10       add(:user_id, references(:users, type: :uuid, on_delete: :delete_all))
11       add(:file_name, :string, null: false)
12       add(:content_type, :string, null: false)
13       add(:processed, :boolean, null: false, default: false)
14       add(:file_size, :bigint)
15
16       timestamps()
17     end
18
19     create_if_not_exists(index(:backups, [:user_id]))
20   end
21 end