Add followers field to actors

This commit is contained in:
Shadowfacts 2019-09-30 19:20:00 -04:00
parent 7548cbe40c
commit 8dddb42fd8
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 11 additions and 1 deletions

View File

@ -14,6 +14,7 @@ defmodule Clacks.Actor do
field :nickname, :string field :nickname, :string
field :local, :boolean field :local, :boolean
field :data, :map field :data, :map
field :followers, {:array, :string}, default: []
belongs_to :user, Clacks.User belongs_to :user, Clacks.User
@ -22,7 +23,7 @@ defmodule Clacks.Actor do
def changeset(%__MODULE__{} = schema, attrs) do def changeset(%__MODULE__{} = schema, attrs) do
schema schema
|> cast(attrs, [:ap_id, :nickname, :local, :data]) |> cast(attrs, [:ap_id, :nickname, :local, :data, :followers])
|> validate_required([:ap_id, :nickname, :local, :data]) |> validate_required([:ap_id, :nickname, :local, :data])
end end

View File

@ -0,0 +1,9 @@
defmodule Clacks.Repo.Migrations.ActorsAddFollowers do
use Ecto.Migration
def change do
alter table(:actors) do
add :followers, {:array, :string}, default: []
end
end
end