Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 5c38ccee authored by Muhammad Rafif Elfazri's avatar Muhammad Rafif Elfazri
Browse files

Delete Status and post_parent_id

parent a96ee483
No related branches found
No related tags found
No related merge requests found
......@@ -5,18 +5,15 @@ defmodule Diskuy.Forum.Post do
schema "posts" do
field :message, :string
field :points, :integer
field :status, :string
field :thread_id, :id
field :post_parent_id, :id
field :user_id, :id
timestamps()
end
@doc false
def changeset(post, attrs) do
post
|> cast(attrs, [:message, :points, :status, :thread_id, :post_parent_id, :user_id])
|> validate_required([:message, :points, :status, :thread_id, :user_id])
|> cast(attrs, [:message, :points, :thread_id, :user_id])
|> validate_required([:message, :points, :thread_id, :user_id])
end
end
......@@ -5,16 +5,13 @@ defmodule Diskuy.Repo.Migrations.CreatePosts do
create table(:posts) do
add :message, :text
add :points, :integer
add :status, :string
add :thread_id, references(:threads, on_delete: :delete_all, type: :id)
add :post_parent_id, references(:posts, on_delete: :nothing, type: :id)
add :user_id, references(:users, on_delete: :delete_all type: :id)
timestamps()
end
create index(:posts, [:thread_id])
create index(:posts, [:post_parent_id])
create index(:posts, [:user_id])
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment