-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2fc4cb
commit 470861e
Showing
8 changed files
with
297 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule MediaServer.Actions.Episode do | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
schema "episode_actions" do | ||
field :episode_id, :integer | ||
field :serie_id, :integer | ||
field :title, :string | ||
field :user_id, :id | ||
field :action_id, :id | ||
|
||
timestamps() | ||
end | ||
|
||
@doc false | ||
def changeset(episode, attrs) do | ||
episode | ||
|> cast(attrs, [:episode_id, :serie_id, :title, :user_id, :action_id]) | ||
|> validate_required([:episode_id, :serie_id, :title, :user_id, :action_id]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
priv/repo/migrations/20220419024142_create_episode_actions.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
defmodule MediaServer.Repo.Migrations.CreateEpisodeActions do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:episode_actions) do | ||
add :episode_id, :integer | ||
add :serie_id, :integer | ||
add :title, :string | ||
add :user_id, references(:users, on_delete: :nothing) | ||
add :action_id, references(:actions, on_delete: :nothing) | ||
|
||
timestamps() | ||
end | ||
|
||
create index(:episode_actions, [:user_id]) | ||
create index(:episode_actions, [:action_id]) | ||
end | ||
end |
Oops, something went wrong.