logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

20220308012601_create_announcements.exs (770B)


  1. defmodule Pleroma.Repo.Migrations.CreateAnnouncements do
  2. use Ecto.Migration
  3. def change do
  4. create_if_not_exists table(:announcements, primary_key: false) do
  5. add(:id, :uuid, primary_key: true)
  6. add(:data, :map)
  7. add(:starts_at, :naive_datetime)
  8. add(:ends_at, :naive_datetime)
  9. add(:rendered, :map)
  10. timestamps()
  11. end
  12. create_if_not_exists table(:announcement_read_relationships) do
  13. add(:user_id, references(:users, type: :uuid, on_delete: :delete_all))
  14. add(:announcement_id, references(:announcements, type: :uuid, on_delete: :delete_all))
  15. timestamps(updated_at: false)
  16. end
  17. create_if_not_exists(
  18. unique_index(:announcement_read_relationships, [:user_id, :announcement_id])
  19. )
  20. end
  21. end