Skip to main content

Configure Database

We recommend using the Devii Portal for [testing and adding databases](/docs/devii_portal/project_details#Add Database Connection), however you can login to Devii Portal API (tenantid 14) and use it's endpoints to create additional databases.

Using Devii Portal API to Test and Create Databases​

Use your Devii Portal login and password, and tenantid:14 to authenticate to Devii Portal API AUTH endpoint to get the access token.

Test Database Connection​

It's recommended to test the database connection with Devii before trying to create a new database. Check connection is an utility function from the roles_pbac endpoint.

Available driver choices are: postgresql, mysql, oracle

{
Utility {
check_connection(
driver: "mysql"
host: "database.host.name"
database: "demo"
username: "username"
password: "password"
)
}
}

Create Database record with Devii Portal API​

This will create the connection to your database using the query endpoint.

For database_env_id: You can query Portal's database_enviroments table for the most current choices.

Available database environments choices are:

IDEnvironment
1Staging
2Production

For database_platform_id: You can query Portal's database_platforms table for the most current choices.

Available database platforms choices are:

IDPlatform
1PostgreSQL
2MySQL/MariaDB
3MS SQL Server
4Oracle DB
5Amazon Aurora - PostgreSQL
6Amazon Aurora - MySQL
mutation create_database($input: databaseInput!) {
create_database(input: $input) {
tenantid
name
projectid
database_env_id
description
isInternal
id
database_platform_id
admin_roleid
}
}
Variables
{
"input": {
"keystore_secrets": {
"host": "database.host.name",
"database": "demo",
"username": "username",
"password": "password"
},
"name": "Demo DB",
"projectid": "<View Note>",
"database_env_id": 1,
"description": "Description for Demo Database",
"isInternal": false,
"database_platform_id": 2
}
}

Output:

{
"data": {
"create_database": {
"admin_roleid": 1111,
"database_env_id": 1,
"database_platform_id": 2,
"description": "Description for Demo Database",
"id": "42",
"isInternal": false,
"name": "Demo DB",
"projectid": 42,
"tenantid": 42
}
}
}

Introspect database​

After making changes to your database you must re-introspect the database for your changes to be queried and/or mutated

query util {
Utility {
introspect
}
}