feat(user): add ecto migration for user
Signed-off-by: supercmmetry <vishaals2000@gmail.com>
This commit is contained in:
parent
6f81702291
commit
9613fcebde
3
lib/ketbin/api/user.ex
Normal file
3
lib/ketbin/api/user.ex
Normal file
@ -0,0 +1,3 @@
|
||||
defmodule Ketbin.Api.User do
|
||||
|
||||
end
|
18
lib/ketbin/arch.ex
Normal file
18
lib/ketbin/arch.ex
Normal 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
3
lib/ketbin/crud/user.ex
Normal file
@ -0,0 +1,3 @@
|
||||
defmodule Ketbin.Crud.User do
|
||||
|
||||
end
|
17
lib/ketbin/schema/user.ex
Normal file
17
lib/ketbin/schema/user.ex
Normal 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
|
12
priv/repo/migrations/20210809085801_create_users.exs
Normal file
12
priv/repo/migrations/20210809085801_create_users.exs
Normal 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
|
Loading…
Reference in New Issue
Block a user