Commit 9fa3f0b1 authored by lain's avatar lain
Browse files

Notification: Change type of `type` to an enum.

parent ca0e6e70
Pipeline #26866 passed with stages
in 9 minutes and 31 seconds
......@@ -30,6 +30,9 @@ defmodule Pleroma.Notification do
schema "notifications" do
field(:seen, :boolean, default: false)
# This is an enum type in the database. If you add a new notification type,
# remembert to add a migration to add it to the `notifications_type` enum
# as well.
field(:type, :string)
belongs_to(:user, User, type: FlakeId.Ecto.CompatType)
belongs_to(:activity, Activity, type: FlakeId.Ecto.CompatType)
defmodule Pleroma.Repo.Migrations.ChangeTypeToEnumForNotifications do
use Ecto.Migration
def up do
create type notification_type as enum (
|> execute()
alter table notifications
alter column type type notification_type using (type::notification_type)
|> execute()
def down do
alter table(:notifications) do
modify(:type, :string)
drop type notification_type
|> execute()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment