-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keep inserted_at value to the original value #36
Conversation
be5e833
to
d4cbc57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good way to get the inserted_at
timestamp for all items, but I'm not sure we want it to be part of the all
function; making two Repo.all
calls, plus mapping over the results could really slow down the query.
I feel like it would be better to override the default inserted_at
timestamp when we update an item, retaining it from the last row.
We could use the code you've written here, but I think using it only once, as part of a migration script which updates the inserted_at
of the most recent items would be better.
@Danwhy makes sense 👍 |
8935531
to
34c76da
Compare
@Danwhy the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one small point
mix.exs
Outdated
@@ -4,7 +4,7 @@ defmodule Alog.MixProject do | |||
def project do | |||
[ | |||
app: :alog, | |||
version: "0.4.2", | |||
version: "0.4.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be 0.5.0 now, as we've changed the behaviour of the module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure about the version. For me it's a patch fix as the API hasn't changed and I don't think this PR add a new functionality, I see keeping the inserted_at
value as a bug fix
MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards-compatible manner, and
PATCH version when you make backwards-compatible bug fixes.
but happy to to update to 0.5.0
if you think the logic of the code is different 👍 , let me know what you prefer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see how this could be considered a bug, but I think it changes enough that it could introduce unexpected errors into code that uses it, eg. someone could have been using inserted_by
to get the most recent items in their database, and now that won't work the same.
I think just to be safe we should bump to 0.5.0
bump version to 0.5.0
.travis.yml
Outdated
otp_release: | ||
- 20.2.4 | ||
env: | ||
- MIX_ENV=test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't think you need this env
, you've already written it below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, thanks @samhstn 👍
remove duplicate env value in travis.yml file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks @SimonLab
@@ -0,0 +1,18 @@ | |||
language: elixir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SimonLab great work, thanks! 👍
ref: #30
Define
inserted_at
value to be the timestamp of the first item inserted