diff options
| author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2022-07-03 20:58:20 +0000 | 
|---|---|---|
| committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2022-07-03 20:58:20 +0000 | 
| commit | 6b937d14737c07312595bb79c35c49b2e9c14fdb (patch) | |
| tree | db54190d8c232d9a0c16d05f51657a31dc5fc3d5 /priv/repo/migrations | |
| parent | 75f912c63f9a18e37f8ddbd403755b878467435a (diff) | |
| parent | 7d1dae3befbecbeeb72768afe4f5a23a59ba4f05 (diff) | |
| download | pleroma-6b937d14737c07312595bb79c35c49b2e9c14fdb.tar.gz pleroma-6b937d14737c07312595bb79c35c49b2e9c14fdb.zip  | |
Merge branch 'from/upstream-develop/tusooa/server-announcements' into 'develop'
Server announcements (1st pass)
See merge request pleroma/pleroma!3643
Diffstat (limited to 'priv/repo/migrations')
| -rw-r--r-- | priv/repo/migrations/20220308012601_create_announcements.exs | 26 | 
1 files changed, 26 insertions, 0 deletions
diff --git a/priv/repo/migrations/20220308012601_create_announcements.exs b/priv/repo/migrations/20220308012601_create_announcements.exs new file mode 100644 index 000000000..01c9ce041 --- /dev/null +++ b/priv/repo/migrations/20220308012601_create_announcements.exs @@ -0,0 +1,26 @@ +defmodule Pleroma.Repo.Migrations.CreateAnnouncements do +  use Ecto.Migration + +  def change do +    create_if_not_exists table(:announcements, primary_key: false) do +      add(:id, :uuid, primary_key: true) +      add(:data, :map) +      add(:starts_at, :naive_datetime) +      add(:ends_at, :naive_datetime) +      add(:rendered, :map) + +      timestamps() +    end + +    create_if_not_exists table(:announcement_read_relationships) do +      add(:user_id, references(:users, type: :uuid, on_delete: :delete_all)) +      add(:announcement_id, references(:announcements, type: :uuid, on_delete: :delete_all)) + +      timestamps(updated_at: false) +    end + +    create_if_not_exists( +      unique_index(:announcement_read_relationships, [:user_id, :announcement_id]) +    ) +  end +end  | 
