diff --git a/lib/wabanex/user.ex b/lib/wabanex/user.ex new file mode 100644 index 0000000..2403553 --- /dev/null +++ b/lib/wabanex/user.ex @@ -0,0 +1,13 @@ +defmodule Wabanex.User do + use Ecto.Schema + + @primary_key {:id, :binary_id, autogenerate: true} + + schema "users" do + field :name, :string + field :email, :string + field :password, :string + + timestamps() + end +end diff --git a/priv/repo/migrations/20210622015725_create_users_table.exs b/priv/repo/migrations/20210622015725_create_users_table.exs new file mode 100644 index 0000000..4e0745a --- /dev/null +++ b/priv/repo/migrations/20210622015725_create_users_table.exs @@ -0,0 +1,15 @@ +defmodule Wabanex.Repo.Migrations.CreateUsersTable do + use Ecto.Migration + + def change do + create table(:users) do + add :email, :string + add :name, :string + add :password, :string + + timestamps() + end + + create unique_index(:users, [:email]) + end +end