feat(user): add ecto migration for user

Signed-off-by: supercmmetry <vishaals2000@gmail.com>
This commit is contained in:
supercmmetry 2021-08-09 14:28:53 +05:30
parent 6f81702291
commit 9613fcebde
No known key found for this signature in database
GPG Key ID: 8E60EF28A328E40D
5 changed files with 53 additions and 0 deletions

3
lib/ketbin/api/user.ex Normal file
View File

@ -0,0 +1,3 @@
defmodule Ketbin.Api.User do
end

18
lib/ketbin/arch.ex Normal file
View File

@ -0,0 +1,18 @@
defmodule Ketbin.Schema do
@moduledoc """
Ketbin keeps the contexts that define your schemas
"""
end
defmodule Ketbin.Crud do
@moduledoc """
Ketbin keeps the contexts that define your CRUD functions
"""
end
defmodule Ketbin.Api do
@moduledoc """
Ketbin keeps the contexts that define your business logic.
"""
end

3
lib/ketbin/crud/user.ex Normal file
View File

@ -0,0 +1,3 @@
defmodule Ketbin.Crud.User do
end

17
lib/ketbin/schema/user.ex Normal file
View File

@ -0,0 +1,17 @@
defmodule Ketbin.Schema.User do
use Ecto.Schema
import Ecto.Changeset
schema "users" do
field :firebase_id, :string
timestamps()
end
@doc false
def changeset(user, attrs) do
user
|> cast(attrs, [:firebase_id])
|> validate_required([:firebase_id])
end
end

View File

@ -0,0 +1,12 @@
defmodule Ketbin.Repo.Migrations.CreateUsers do
use Ecto.Migration
def change do
create table(:users) do
add :firebase_id, :string
timestamps()
end
end
end