Create user

Create profile
added some validation
This commit is contained in:
2023-02-17 08:29:33 +00:00
parent 57dae2bee3
commit bb1f5d74d8
19 changed files with 797 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
defmodule PhoenixApiTemplate.Repo.Migrations.CreateUsers do
use Ecto.Migration
def change do
create table(:users, primary_key: false) do
add :id, :binary_id, primary_key: true
add :email, :string
add :hashed_password, :string
timestamps()
end
create unique_index(:users, [:email])
end
end

View File

@@ -0,0 +1,15 @@
defmodule PhoenixApiTemplate.Repo.Migrations.CreateProfiles do
use Ecto.Migration
def change do
create table(:profiles, primary_key: false) do
add(:id, :binary_id, primary_key: true)
add(:display_name, :string)
add(:user_id, references(:users, on_delete: :delete_all, type: :binary_id))
timestamps()
end
create(index(:profiles, [:user_id, :display_name]))
end
end