Configure Database
We recommend using the Devii Portal for testing and adding databases, 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 enviroments choices are:
ID | Environment |
---|---|
1 | Staging |
2 | Production |
For database_platform_id: You can query Portal's database_platforms table for the most current choices.
Available database platforms choices are:
ID | Platform |
---|---|
1 | PostgreSQL |
2 | MySQL/MariaDB |
3 | MS SQL Server |
4 | Oracle DB |
5 | Amazon Aurora - PostgreSQL |
6 | Amazon 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
}
}
{
"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 reintrospect the database for your changes to be queried and/or mutated
query util {
Utility {
introspect
}
}