Skip to content

Commit

Permalink
removed full name
Browse files Browse the repository at this point in the history
  • Loading branch information
Krrupa committed Jul 4, 2023
1 parent 8825257 commit 8779797
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
40 changes: 22 additions & 18 deletions lib/dbservice/users/user.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,37 @@ defmodule Dbservice.Users.User do
alias Dbservice.Groups.GroupType

schema "user" do
field :address, :string
field :city, :string
field :district, :string
field :email, :string
field :full_name, :string
field :gender, :string
field :phone, :string
field :pincode, :string
field :role, :string
field :state, :string
field :whatsapp_phone, :string
field :date_of_birth, :date
field :country, :string
field(:address, :string)
field(:city, :string)
field(:district, :string)
field(:email, :string)
field(:first_name, :string)
field(:middle_name, :string)
field(:last_name, :string)
field(:gender, :string)
field(:phone, :string)
field(:pincode, :string)
field(:role, :string)
field(:state, :string)
field(:whatsapp_phone, :string)
field(:date_of_birth, :date)
field(:country, :string)

timestamps()

many_to_many :sessions, SessionOccurence, join_through: "user_session", on_replace: :delete
has_one :teacher, Teacher
has_one :student, Student
many_to_many :group_type, GroupType, join_through: "group_user", on_replace: :delete
many_to_many(:sessions, SessionOccurence, join_through: "user_session", on_replace: :delete)
has_one(:teacher, Teacher)
has_one(:student, Student)
many_to_many(:group_type, GroupType, join_through: "group_user", on_replace: :delete)
end

@doc false
def changeset(user, attrs) do
user
|> cast(attrs, [
:full_name,
:first_name,
:middle_name,
:last_name,
:email,
:phone,
:gender,
Expand Down
12 changes: 12 additions & 0 deletions priv/repo/migrations/20230704073810_modify_user_table.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
defmodule Dbservice.Repo.Migrations.ModifyUserTable do
use Ecto.Migration

def change do
alter table(:user) do
remove :full_name
add(:first_name, :string)
add(:last_name, :string)
add(:middle_name, :string)
end
end
end

0 comments on commit 8779797

Please sign in to comment.