Skip to content
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

add support for DATABASE_SEARCH_PATH #3823

Closed

Conversation

ruslandoga
Copy link
Contributor

@ruslandoga ruslandoga commented Feb 24, 2024

Changes

This PR adds support for custom PostgreSQL search_path as requested in #3799

  • I'll need to check if this approach is good enough.

Tests

  • Automated tests have been added

Changelog

  • Entry has been added to changelog

Documentation

  • Docs have been updated

Dark mode

  • This PR does not change the UI

@ruslandoga ruslandoga self-assigned this Feb 24, 2024
@ruslandoga ruslandoga mentioned this pull request Mar 17, 2024
4 tasks
@ruslandoga ruslandoga added the self-hosting Anything self-hosted label Mar 18, 2024
@Nikola-Milovic
Copy link

Any ETA for the release this would be included in?

@ruslandoga ruslandoga marked this pull request as ready for review May 7, 2024 09:46
@ruslandoga ruslandoga requested a review from a team May 7, 2024 09:46
@ruslandoga
Copy link
Contributor Author

ruslandoga commented May 7, 2024

@plausible/developers any advice on how to test this? :)

@ruslandoga
Copy link
Contributor Author

@Nikola-Milovic could you please verify that the approach in #3799 (reply in thread) worked?

@ruslandoga ruslandoga force-pushed the support-postgresql-search_path branch from 7826e0a to 13424d3 Compare May 7, 2024 10:17
@Nikola-Milovic
Copy link

@ruslandoga Pretty much working

postgres=# \dn
   List of schemas
   Name    |  Owner
-----------+----------
 plausible | postgres
 public    | postgres
(2 rows)

postgres=# \d
                List of relations
 Schema |       Name       |   Type   |  Owner
--------+------------------+----------+----------
 public | oban_jobs        | table    | postgres
 public | oban_jobs_id_seq | sequence | postgres
 public | oban_peers       | table    | postgres
(3 rows)

postgres=# set schema 'plausible';
SET
postgres=# \d
                          List of relations
  Schema   |               Name                |   Type   |  Owner
-----------+-----------------------------------+----------+----------
 plausible | api_keys                          | table    | postgres
 plausible | api_keys_id_seq                   | sequence | postgres
 plausible | check_stats_emails                | table    | postgres
 plausible | check_stats_emails_id_seq         | sequence | postgres
 plausible | create_site_emails                | table    | postgres
 plausible | create_site_emails_id_seq         | sequence | postgres
 plausible | custom_domains                    | table    | postgres
 plausible | custom_domains_id_seq             | sequence | postgres
 plausible | email_verification_codes          | table    | postgres
 plausible | enterprise_plans                  | table    | postgres
 plausible | enterprise_plans_id_seq           | sequence | postgres
 plausible | feedback_emails                   | table    | postgres
 plausible | feedback_emails_id_seq            | sequence | postgres
 plausible | fun_with_flags_toggles            | table    | postgres
 plausible | fun_with_flags_toggles_id_seq     | sequence | postgres
 plausible | goals                             | table    | postgres
 plausible | goals_id_seq                      | sequence | postgres
 plausible | google_auth                       | table    | postgres
 plausible | google_auth_id_seq                | sequence | postgres
 plausible | intro_emails                      | table    | postgres
 plausible | intro_emails_id_seq               | sequence | postgres
 plausible | invitations                       | table    | postgres
 plausible | invitations_id_seq                | sequence | postgres
 plausible | monthly_reports                   | table    | postgres
 plausible | monthly_reports_id_seq            | sequence | postgres
postgres=# \d

The oban library seems to still put its schemas into public

Demo https://github.com/Nikola-Milovic/plausible-schema-demo

docker compose up should just work

@ruslandoga
Copy link
Contributor Author

ruslandoga commented May 8, 2024

There have been some changes since v2.0.0 that make it harder to support this env var, please see https://github.com/Nikola-Milovic/plausible-schema-demo/pull/1#issue-2284553627

Since the current PR is not going to solve the root issue anyway (due to failing migrations), I'm going to close it. Sorry!

@ruslandoga ruslandoga closed this May 8, 2024
@ruslandoga ruslandoga deleted the support-postgresql-search_path branch May 8, 2024 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
self-hosting Anything self-hosted
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants