FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Using a non-default schema on a custom postgres DB

    Scheduled Pinned Locked Moved Q&A
    5 Posts 3 Posters 3.4k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cyrill.lippuner
      last edited by

      Hi, I have been using the local docker setup for fusionauth with a local postgres db until now. Now I wanted to switch to a hosted DB solution, where I do not want to give the root passwords to the fusionauth app, but instead set up the DB schema manually. This worked so far without any problems, but I was wondering whether I could install the DB schema as a non-default schema instead of using the public schema which is provided by the DB at launch?

      I was able to set it up and create a user, but the connection url jdbc:postgresql://db:5432/fusionauth and the config files do not provide the possibility to select a specific schema on the DB and default automatically to public.

      Such as

      CREATE SCHEMA my_fusionauth_schema
          AUTHORIZATION postgres;
      
      ALTER DEFAULT PRIVILEGES IN SCHEMA my_fusionauth_schema
      GRANT INSERT, SELECT, UPDATE, DELETE ON TABLES TO fusionauth;
      

      Bildschirmfoto 2021-04-26 um 09.26.44.png

      Thank you for your answer ansd clarifications.

      Cyrill

      1 Reply Last reply
      Reply Quote 0
      • danD
        dan
        last edited by

        Hmm. I don't know. Is there a way to specify the schema on the JDBC URL?

        https://stackoverflow.com/a/4820666/203619 looks promising, that's what I'd try.

        --
        FusionAuth - Identity Without Constraints
        https://fusionauth.io

        1 Reply Last reply
        Reply Quote 0
        • C
          cyrill.lippuner
          last edited by

          This is something I have already tried ad did not work. At least not with my setup. I have changed my setup and use now two databases instead of two schemas.

          1 Reply Last reply
          Reply Quote 1
          • danD
            dan
            last edited by

            Excellent, thanks for looping back. If you'd like, feel free to file an issue about supporting non public postgresql schemas: https://github.com/fusionauth/fusionauth-issues/issues

            --
            FusionAuth - Identity Without Constraints
            https://fusionauth.io

            1 Reply Last reply
            Reply Quote 1
            • J
              jackehedaya
              last edited by

              I was able to get this working with:

              jdbc:postgresql://db:5432/mydb?currentSchema=auth
              
              1 Reply Last reply
              Reply Quote 0
              • danD dan moved this topic from Q&A on
              • danD dan moved this topic from Frequently Asked Questions (FAQ) on

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post