Add tokens table

This commit is contained in:
Nat 2023-06-06 09:03:11 -07:00
parent cc9b244fee
commit 529cde4836
Signed by: nat
GPG Key ID: B53AB05285D710D6
2 changed files with 30 additions and 0 deletions

18
lib/hostas/token.ex Normal file
View File

@ -0,0 +1,18 @@
defmodule Hostas.Token do
use Ecto.Schema
import Ecto.Changeset
schema "tokens" do
field :id, :integer
field :expires, :utc_datetime
timestamps()
end
@doc false
def changeset(token, attrs) do
token
|> cast(attrs, [:id, :expires])
|> validate_required([:id, :expires])
end
end

View File

@ -0,0 +1,12 @@
defmodule Hostas.Repo.Migrations.CreateTokens do
use Ecto.Migration
def change do
create table(:tokens) do
add :id, :integer
add :expires, :utc_datetime
timestamps()
end
end
end