Skip to content

Commit

Permalink
removes comments that are no longer needed #45
Browse files Browse the repository at this point in the history
  • Loading branch information
RobStallion committed Mar 4, 2019
1 parent 5c801b4 commit 90927de
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
9 changes: 1 addition & 8 deletions lib/alog.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ defmodule Alog do

@behaviour Ecto.Adapter.Storage

# Why did we define our own version of this function?
# Sorry if I have missed something that has been explained already.
@impl true
def supports_ddl_transaction?, do: true

Expand Down Expand Up @@ -41,18 +39,13 @@ defmodule Alog do
params =
map_for_cid
|> add_timestamps()
|> Map.put(:cid, cid) # <==== Should this be Map.put(:id, cid)??????????
|> Map.put(:cid, cid)
|> Map.put(:entry_id, entry_id)
|> Enum.into([])

insert_logic(adapter_meta, source, prefix, params, on_conflict, returning, opts)
end

# I think that this step need to also make sure that the data is not an exact copy.
# if the full cid already exists then this is duplicate data.
# Should we insert duplicate data.
# i was thinking maybe if it was existing data but not the most recent data we should re-insert the data
# e.g. if the comment was hi, edited to hey, and then changed back to hi.
defp create_entry_id(source, adapter_meta, cid, n) do
entry_id = String.slice(cid, 0..n)
entry_id_query = "SELECT * FROM #{source} where entry_id='#{entry_id}'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ defmodule Alog.Repo.Migrations.CreateComments do

def change do
create table(:comments, primary_key: false) do
# cid & entry_id need to be removed later as they should be handled in execute_ddl I believe
# timestamps are needed in alog but may or may not be in the schema.
add(:cid, :string, primary_key: true)
add(:entry_id, :string)
add(:deleted, :boolean, default: false)
Expand Down

0 comments on commit 90927de

Please sign in to comment.