Skip to content

Commit

Permalink
WIP add episode id to nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
electronicbites committed Dec 16, 2023
1 parent 6c4651e commit c028b7f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/radiator/outline/node.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ defmodule Radiator.Outline.Node do
"""
use Ecto.Schema
import Ecto.Changeset
alias Radiator.Podcast.Episode

@derive {Jason.Encoder, only: [:uuid, :content, :creator_id, :parent_id, :prev_id]}

Expand All @@ -15,11 +16,14 @@ defmodule Radiator.Outline.Node do
field :parent_id, Ecto.UUID
field :prev_id, Ecto.UUID

belongs_to :episode, Episode

timestamps(type: :utc_datetime)
end

@required_fields [
:content
:content,
:episode_id
]

@optional_fields [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule Radiator.Repo.Migrations.AddOutlineReferenceToEpisode do
use Ecto.Migration

def change do
alter table(:outline_nodes) do
add :episode_id, references(:episodes, on_delete: :nothing)
end
end
end

0 comments on commit c028b7f

Please sign in to comment.