Note: As we are making changes to Database Schema, it is highly susceptible to havE a snapshot of the database before processing any of the steps.
Step 1:
Create a new Schema let's say ‘private’ in the entire use case here ( Password can be altered).
<CREATE USER private WITH PASSWORD ‘password’;> <CREATE SCHEMA IF NOT EXISTS artifactory AUTHORIZATION private;>
Step 2:
Alter the name of the schema default ‘postgres’(default schema) to private using the below command.
<ALTER SCHEMA name postgres TO private;>
Step 3:
Revoke the schema postgres
<REVOKE CREATE ON SCHEMA public FROM public;>
Step 4:
GRANT USAGE ON SCHEMA postgres TO private;
Step 5:
Set the search_path to private using the below command.
<SET search_path TO postgres, private;>
We need to make the changes in the system.yaml file as shown below.
database:
## One of mysql, oracle, mssql, postgresql, mariadb ## Default Embedded derby ## Example for postgresql type: postgresql driver: org.postgresql.Driver url: "jdbc:postgresql://<ipaddress or dns>:5432/artifactory?currentSchema=private" username: artifactory password: plaintext password metadata: database: url: go:user='postgres' password='${shared.database.password}' dbname=artifactory host=ip address port=5432 search_path='private' sslmode=disable
Please be informed that Artifactory is written in Java and Metadata is written in Golang. So we need to provide a connection string for Metadata service to use the specific schema, in our case, it is "artifactory". Please note that we need to mention search_path='private' in the system.yaml as shown below for metadata service.
Perform a few uploads and validate if packages could were stored under the relevant tables in the "private" schema.