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
    3
    5
    1.0k
    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 - Auth for devs, built by devs.
        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 - Auth for devs, built by devs.
            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
              • First post
                Last post