Add tags schema.

This commit is contained in:
Jessica Canady 2024-09-24 10:58:25 -04:00
parent fa9760a94b
commit 7210b38757
Signed by: phoenix
SSH key fingerprint: SHA256:aaLOzOrLi+0n4eDZNQKH97PehwRt6KSE5fYJc+ZRKCQ
2 changed files with 28 additions and 0 deletions

17
lib/jol/blog/tags.ex Normal file
View file

@ -0,0 +1,17 @@
defmodule JOL.Blog.Tags do
use Ecto.Schema
import Ecto.Changeset
schema "tags" do
field :name, :string
timestamps(type: :utc_datetime)
end
@doc false
def changeset(tags, attrs) do
tags
|> cast(attrs, [:name])
|> validate_required([:name])
end
end

View file

@ -0,0 +1,11 @@
defmodule JOL.Repo.Migrations.CreateTags do
use Ecto.Migration
def change do
create table(:tags) do
add :name, :string
timestamps(type: :utc_datetime)
end
end
end