Skip to content

Commit

Permalink
EHN: Add embeded schema, which causes array value drop
Browse files Browse the repository at this point in the history
  • Loading branch information
Rio517 committed Aug 21, 2023
1 parent f660b5d commit 37c6a7b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/live_admin_issue/posts/post.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ defmodule LiveAdminIssue.Posts.Post do
field :title, :string
field :view, :integer

embeds_many :comments, Comment do
field :body, :string
field :user, :string
field :tags, {:array, Ecto.Enum}, values: [:tag1, :tag2, :tag3]
end

timestamps()
end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule LiveAdminIssue.Repo.Migrations.AddEmbeddedFieldToPosts do
use Ecto.Migration

def change do
alter table(:posts) do
add :comments, {:array, :map}
end
end
end

0 comments on commit 37c6a7b

Please sign in to comment.