Add tokens table
This commit is contained in:
parent
cc9b244fee
commit
529cde4836
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue