Skip to content

Commit

Permalink
Fix up some sql
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Jul 24, 2024
1 parent 35422d3 commit b0fb139
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 362 deletions.
277 changes: 0 additions & 277 deletions Queries.hs

This file was deleted.

10 changes: 5 additions & 5 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ services:
POSTGRES_PASSWORD: sekrit
volumes:
- ../sql:/docker-entrypoint-initdb.d
# # Optionally persist the data between container invocations
# - postgresVolume:/var/lib/postgresql/data
# Optionally persist the data between container invocations
- postgresVolume:/var/lib/postgresql/data
- ./postgresql.conf:/etc/postgresql/postgresql.conf
command: postgres -c config_file=/etc/postgresql/postgresql.conf # -c log_statement=all
command: postgres -c config_file=/etc/postgresql/postgresql.conf -c log_statement=all


redis:
Expand Down Expand Up @@ -85,5 +85,5 @@ services:
- redis
- postgres

# volumes:
# postgresVolume:
volumes:
postgresVolume:
1 change: 1 addition & 0 deletions share-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ library
Share.Postgres.Projects.Queries
Share.Postgres.Queries
Share.Postgres.Refs.Types
Share.Postgres.Releases.Queries
Share.Postgres.Search.DefinitionSearch.Queries
Share.Postgres.Serialization
Share.Postgres.Sync.Conversions
Expand Down
31 changes: 0 additions & 31 deletions src/Share/Postgres/Hashes/Queries.hs
Original file line number Diff line number Diff line change
Expand Up @@ -338,34 +338,3 @@ expectCausalIdByHash :: (HasCallStack) => CausalHash -> Codebase.CodebaseM e Cau
expectCausalIdByHash causalHash = do
loadCausalIdByHash causalHash
`whenNothingM` unrecoverableError (MissingExpectedEntity $ "Expected causal id for hash: " <> tShow causalHash)

-- | TODO:

---- | Expands shorthashes to their full form (still as a ShortHash)
----
---- Note: Be wary, this could cause hashes which are unknown to a user to leak if they're not
-- expandShortHashesOf :: (HasCallStack) => Traversal s t ShortHash ShortHash -> s -> CodebaseM e t
-- expandShortHashesOf trav s = do
-- codebaseOwner <- asks Codebase.codebaseOwner
-- s
-- & unsafePartsOf (trav . prefix_) %%~ \shortHashes -> do
-- let numberedShortHashes = zip [0 :: Int32 ..] shortHashes
-- results :: [Text] <-
-- queryListCol
-- [sql|
-- WITH hash_prefixes(ord, prefix) AS (
-- SELECT * FROM ^{toTable numberedShortHashes}
-- )
-- SELECT sh.prefix
-- FROM hash_prefixes sh
-- JOIN short_hashes sh2 ON sh.prefix = sh2.prefix
-- ORDER BY sh.ord ASC
-- |]
-- if length results /= length shortHashes
-- then error "expandShortHashesOf: Missing expected short hash"
-- else pure results
-- where
-- prefix_ :: Traversal' ShortHash Text
-- prefix_ f = \case
-- SH.Builtin b -> pure $ SH.Builtin b
-- SH.ShortHash p c i -> SH.ShortHash <$> f p <*> pure c <*> pure i
Loading

0 comments on commit b0fb139

Please sign in to comment.