feat(user): add ecto migration for user
Signed-off-by: supercmmetry <vishaals2000@gmail.com>
This commit is contained in:
5 files changed
+53
No files matched your search
@@ -0,0 +1,3 @@
|
|||||||
|
defmodule Ketbin.Api.User do
|
||||||
|
|
||||||
|
end
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
defmodule Ketbin.Crud.User do
|
||||||
|
|
||||||
|
end
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
Reference in new issue
Block a user