summaryrefslogtreecommitdiffstats
path: root/store/sqlstore/post_store.go
Commit message (Collapse)AuthorAgeFilesLines
* MM-11781: Basic Data Export Command Line. (#9296)George Goldberg2018-09-171-0/+65
| | | | | | | | | | | | | | | | * MM-11781: Basic Data Export Command Line. * ChannelStore new unit tests. * TeamStore new unit tests. * Unit test for new UserStore function. * Unit tests for post store new methods. * Review fixes. * Fix duplicate command name.
* Speed up search results post selection. (#9380)Christopher Speller2018-09-101-1/+1
|
* Feature/search after before on (#9219)Dmitry Samuylov2018-08-281-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | * initial implementation of after, before, on search flags allowing to restrict the search to a specific day or a date range * missed setting beforeDate in SearchParams in one place * fixed condition when only flags are used for search without any plain terms * changed date format used for after/before/on flags to be in ISO8601 format as suggested in PR comments, added a helper function to pad month and day with zeroes allowing the user user either format, with or without leading zeroes * corrected expected compare to date setting for the TestParseDateFilterToTimeISO8601 test * fixed a bug for the scenario when you only have the date flags without any terms, added a couple of tests for that scenario * updated the date filter logic to use parameters to construct the query instead of simply appending strings together, as suggested in the pull request comments * added search unit test using date flags * added a helper function to create a test post with a createat date manually set, updated the test for search using date flags to create test posts with different createat dates to be able to better test the functionality * MM-11817 Add support for after/before/on search flags with Elasticsearch * add support to search posts to perform the search in context of the client's timezone when filtering by createat date using on: after: before: flags * updated tests to match the new signature
* Pr 9039 (#9187)Martin Kraft2018-07-301-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * MM-11065: Allow to search and get archived channels from the API * Fixing more tests * Add some unit tests * Add includeDeleted parameter to session permissions check function * More test fixing * Adding archive channels list in channels search * Add restriction for archived channel edition * Reverting permissions checks modification * Changed the query parameter to include_deleted * Enable search archive channels as true by default * Adding tests for verify search on deleted channels * Allowing to override archive channels during the imports * Fixed test * Search in archive channels from the API must be explicitly requested * Removing includeDeleted parameter from GetChannelByName and GetChannelByNameForTeam * Back to ViewArchivedChannels config * Fixing tests * Reverting GetChannelByName parameter * Add include deleted parameter on GetChannel functions in plugins api * Fixing tests
* MM-10412: Adds deleteBy prop to posts. (#8896)Martin Kraft2018-06-011-3/+16
|
* Revert "MM-9770: rewrite getParentsPosts to improve performance (#8467)" ↵Derrick Anderson2018-04-301-62/+23
| | | | | (#8659) (#8694) This reverts commit 4b675b347b5241def7807fab5e01ce9b98531815.
* Structured logging (#8673)Christopher Speller2018-04-271-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implementing structured logging * Changes to en.json to allow refactor to run. * Fixing global logger * Structured logger initalization. * Add caller. * Do some log redirection. * Auto refactor * Cleaning up l4g reference and removing dependancy. * Removing junk. * Copyright headers. * Fixing tests * Revert "Changes to en.json to allow refactor to run." This reverts commit fd8249e99bcad0231e6ea65cd77c32aae9a54026. * Fixing some auto refactor strangeness and typo. * Making keys more human readable.
* MM-9661: tweak post message size log (#8517)Jesse Hallam2018-03-291-2/+2
| | | | Call out the number of supported characters explicitly, moving the byte limit to parentheses.
* Relax 4k post message limit (#8478)Jesse Hallam2018-03-261-57/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * MM-9661: rename POST_MESSAGE_MAX_RUNES to \0_v1 * MM-9661: s/4000/POST_MESSAGE_MAX_RUNES_V1/ in tests * MM-9661: introduce POST_MESSAGE_MAX_RUNES_V2 * MM-9661: migrate Postgres Posts.Message column to TEXT from VARCHAR(4000) This is safe to do in a production instance since the underyling type is not changing. We explicitly don't do this automatically for MySQL, but also don't need to since the ORM would have already created a TEXT column for MySQL in that case. * MM-9661: emit MaxPostSize in client config This value remains unconfigurable at this time, but exposes the current limit to the client. The limit remains at 4k in this commit. * MM-9661: introduce and use SqlPostStore.GetMaxPostSize Enforce a byte limitation in the database, and use 1/4 of that value as the rune count limitation (assuming a worst case UTF-8 representation). * move maxPostSizeCached, lastPostsCache and lastPostTimeCache out of the global context and onto the SqlPostStore * address feedback from code review: * ensure sqlstore unit tests are actually being run * move global caches into SqlPostStore * leverage sync.Once to address a race condition * modify upgrade semantics to match new db semantics gorp's behaviour on creating columns with a maximum length on Postgres differs from MySQL: * Postgres * gorp uses TEXT for string columns without a maximum length * gorp uses VARCHAR(N) for string columns with a maximum length of N * MySQL * gorp uses TEXT for string columns with a maximum length >= 256 * gorp uses VARCHAR(N) for string columns with a maximum length of N * gorp defaults to a maximum length of 255, implying VARCHAR(255) So the Message column has been TEXT on MySQL but VARCHAR(4000) on Postgres. With the new, longer limits of 65535, and without changes to gorp, the expected behaviour is TEXT on MySQL and VARCHAR(65535) on Postgres. This commit makes the upgrade semantics match the new database semantics. Ideally, we'd revisit the gorp behaviour at a later time. * allow TestMaxPostSize test cases to actually run in parallel * default maxPostSizeCached to POST_MESSAGE_MAX_RUNES_V1 in case the once initializer panics * fix casting error * MM-9661: skip the schema migration for Postgres It turns out resizing VARCHAR requires a rewrite in some versions of Postgres, but migrating VARCHAR to TEXT does not. Given the increasing complexity, let's defer the migration to the enduser instead.
* MM-9770: rewrite getParentsPosts to improve performance (#8467)Jesse Hallam2018-03-161-23/+62
| | | | | | | | | | | | | | | | | | | | * rename variables in testPostStoreGetPostsWithDetails This helps to clarify the structure of the posts under test. * clarify and expand existing testPostStoreGetPostsWithDetails assertions * expand testPostStoreGetPostsWithDetails assertions This verifies that replies to posts in the window, themselves not in the window (because of a non-zero offset) are still fetched. They were previously missing. * MM-9770: rewrite getParentsPosts to improve performance See discussion on ~developers-performance, but the basic idea here is to force the database to use the `PRIMARY` index when fetching posts instead of trying to filter down by channel and doing a scan.
* MM-9664 Add invalidation metrics for store caches (#8340)Joram Wilander2018-03-051-1/+11
| | | | | | | | * Add invalidation metrics for store caches * Increment session invalidation metric * Fix tests
* ABC-228 Update GetPosts caching to work for non-60 limits (#8233)Joram Wilander2018-02-091-5/+10
| | | | | | | | * Update GetPosts caching to work for non-60 limits * Only cache on limits of 30/60 and add test * Add comments clarifying 30 and 60 limits
* PLT-8483: Ignore join/leave team messages for unread counts (#8042)Jesús Espino2018-01-051-2/+4
|
* fix posts created at test (#7977)Chris2017-12-141-2/+2
|
* Fixing formating on SQL errors for get parent posts. (#7965)Christopher Speller2017-12-121-1/+1
|
* simplify things (#7735)Chris2017-10-301-1/+1
|
* Adding Posts table indexes for 20M rows. (#7728)Christopher Speller2017-10-271-0/+4
|
* PLT-7934: Make query for bulk elasticsearch indexing more efficient. (#7664)George Goldberg2017-10-251-14/+34
|
* store/sqlstore cleanup and postgres tests (#7595)Chris2017-10-091-13/+5
| | | | | | | | | | * sqlstore cleanup / postgres tests * remove stopped containers * cmd/platform compile fix * remove test-postgres target from makefile
* fix GetPostsByIds error (#7591)Chris2017-10-061-1/+1
|
* reduce store boiler plate (#7585)Chris2017-10-061-326/+54
|
* Parameterized post ids to avoid possible sql injection (#7575)Jonathan2017-10-041-3/+14
|
* Move sql store code into store/sqlstore package (#7502)Chris2017-09-251-0/+1393
* move sql store code into store/sqlstore package * move non-sql constants back up to store * fix api test * derp