mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-23 00:14:48 +00:00
fix(backend): validate length of instance actor details and set description column to text
Closes #1393 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
eb43b7c79c
commit
f7585cfc75
2 changed files with 19 additions and 0 deletions
|
@ -34,6 +34,10 @@ defmodule Mobilizon.Instances.InstanceActor do
|
||||||
instance_actor
|
instance_actor
|
||||||
|> cast(attrs, @attrs)
|
|> cast(attrs, @attrs)
|
||||||
|> validate_required(@required_attrs)
|
|> validate_required(@required_attrs)
|
||||||
|
|> validate_length(:domain, max: 254)
|
||||||
|
|> validate_length(:instance_name, max: 254)
|
||||||
|
|> validate_length(:software, max: 254)
|
||||||
|
|> validate_length(:software_version, max: 254)
|
||||||
|> unique_constraint(:domain)
|
|> unique_constraint(:domain)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
defmodule Mobilizon.Storage.Repo.Migrations.ChangeActorInstanceDescriptionTypeToText do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def up do
|
||||||
|
alter table(:instance_actors) do
|
||||||
|
modify(:instance_description, :text)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
alter table(:instance_actors) do
|
||||||
|
modify(:instance_description, :string)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue