Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

Plugin storage #87

Merged
merged 21 commits into from
Jan 6, 2021
Merged

Plugin storage #87

merged 21 commits into from
Jan 6, 2021

Conversation

mariusandra
Copy link
Collaborator

@mariusandra mariusandra commented Jan 5, 2021

  • Depends on Plugin storage model posthog#2852
  • Adds storage.get(key, defaultValue) and storage.set(key, value) into meta, which act as buckets to store random JSON data
  • Useful for scheduled and other plugins to store state
  • I removed the postgres mock and made all tests use a real DB (defaults to "posthog_test"). The piscina worker threads anyway can't be mocked and need a real postgres and a real redis to be present, so why not for the main app as well. This makes the test env closer to production and makes testing easier. Side-effect, must run createdb postgrest_test && yarn task:db-init locally before running test.
  • Closes Persistent storage #74

@mariusandra mariusandra requested a review from Twixes January 5, 2021 11:51
Copy link
Member

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

Just a couple of Qs.

Copy link
Member

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

Tests red 🆘

@mariusandra
Copy link
Collaborator Author

Fixed with an appropriate commit message.

@mariusandra mariusandra requested a review from Twixes January 6, 2021 22:11
Copy link
Member

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

Tests green ❇️

@Twixes Twixes merged commit e11f469 into master Jan 6, 2021
@Twixes Twixes deleted the plugin-storage branch January 6, 2021 22:16
fuziontech pushed a commit to PostHog/posthog that referenced this pull request Oct 12, 2021
* 0.6.1

* plugin storage extension

* create plugin storage db

* [WIP] use real postgres in tests

* close resetTestDatabase connection, remove unused code

* fix vm test

* remove unused resolve

* remove unused eslint

* cleaner test command, which makes tests pass as well

* fix benchmark/test

* storage extension type from new scaffold version

* use unique index and upsert for updating storage

* remove team from plugin storage

* Format createPluginStorage SQL with pgFormatter

* remove await

* check for process.env.NODE_ENV === 'test' directly instead of the jest workaround

* init test dv

* fix lazy-ass merge

Co-authored-by: Michael Matloka <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Persistent storage
2 participants