Skip to content

adding upsertWhere and upsertManyWhere to persistent-postgresql - #1222

Merged
parsonsmatt merged 41 commits into
yesodweb:masterfrom
dmarticus:MER-676
Apr 8, 2021
Merged

parsonsmatt merged 41 commits into
yesodweb:masterfrom
dmarticus:MER-676

Conversation

@dmarticus

@dmarticus dmarticus commented Mar 31, 2021 •

Copy link
Copy Markdown
Contributor

Before submitting your PR, check that you've:

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Bumped the version number if there isn't an (unreleased) on the Changelog
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

@dmarticus dmarticus changed the title Mer 676 adding upsertWhere and upsertManyWhere Mar 31, 2021
@dmarticus
dmarticus marked this pull request as draft March 31, 2021 21:29
Comment thread persistent-postgresql/ChangeLog.md Outdated
Comment thread persistent-mysql/Database/Persist/MySQL.hs
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
Comment thread persistent/Database/Persist/Sql/Orphan/PersistQuery.hs
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs
@dmarticus
dmarticus marked this pull request as ready for review March 31, 2021 22:02
@dmarticus dmarticus changed the title adding upsertWhere and upsertManyWhere adding upsertWhere and upsertManyWhere to persistent-postgresql Apr 1, 2021
Comment thread .github/workflows/haskell.yml Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs
Comment thread .github/workflows/haskell.yml
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
Comment thread persistent-postgresql/README.md
Comment thread persistent-postgresql/test/PgInit.hs
Comment thread persistent/Database/Persist/Sql/Util.hs Outdated
Comment thread persistent-postgresql/test/UpsertWhere.hs
Comment thread persistent-postgresql/test/UpsertWhere.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
Comment thread persistent-postgresql/test/UpsertWhere.hs
Comment thread persistent-postgresql/test/UpsertWhere.hs
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
Comment thread persistent/Database/Persist/Sql/Orphan/PersistQuery.hs Outdated
Comment thread persistent/Database/Persist/Sql/Orphan/PersistQuery.hs Outdated
Comment thread persistent/Database/Persist/Sql/Orphan/PersistQuery.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
--
-- -- @since 2.12.1.0
upsertManyWhere ::
forall record backend m.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the project does use 4 space indentation - could you get that done?

(on master I've created .editorconfig and .stylish-haskell.yaml files which will help make that easier)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh my bad, I tried running stylish-haskell before pushing; I'll try again.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stylish-haskell won't do formatting changes like that :\ It's fine to leave as-is, it can ge trefactored later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OH good to know

{-# LANGUAGE OverloadedStrings #-}

module Database.Persist.Postgresql.Util (
mkPostgresUpdateText

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this module only has one function, let's just put it directly in Database.Persist.Postgresql

Comment thread persistent-postgresql/Database/Persist/Postgresql/Util.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql/Util.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql/Util.hs Outdated
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs
Comment thread persistent-postgresql/Database/Persist/Postgresql.hs Outdated
--
-- -- @since 2.12.1.0
upsertManyWhere ::
forall record backend m.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stylish-haskell won't do formatting changes like that :\ It's fine to leave as-is, it can ge trefactored later.

-- `upsertManyWhere`
--
-- @since 2.12.1.0
-- TODO: we could probably make a sum type for the `Filter` record that's passed into the `upserWhere` and

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parsonsmatt does this TODO say enough/make sense?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah!

Comment thread persistent-postgresql/test/UpsertWhere.hs Outdated
Comment thread persistent-postgresql/test/UpsertWhere.hs
Comment thread persistent-postgresql/test/UpsertWhere.hs Outdated
@dmarticus

Copy link
Copy Markdown
Contributor Author

@parsonsmatt did I address all the changes needed?

Comment thread persistent-mysql/test/InsertDuplicateUpdate.hs
-- `upsertManyWhere`
--
-- @since 2.12.1.0
-- TODO: we could probably make a sum type for the `Filter` record that's passed into the `upserWhere` and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah!

@parsonsmatt
parsonsmatt merged commit 9f25cb8 into yesodweb:master Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants