Add followers field to actors
This commit is contained in:
parent
7548cbe40c
commit
8dddb42fd8
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue