Modulify

Check the site database

get_site_database

Checks whether a site has a database, whether it is running and which engine it runs.

The engine comes back in the database type field, and it decides the SQL dialect execute_sql has to be written in, so read it before writing a statement by hand. isAvailable says whether the database is running right now, and a site with no database comes back with database set to null. Check this first when a data tool cannot reach the database.

The connection string, host, port, user and password are never returned here, and create_site_database does not return them either. The stored DATABASE_URL and DATABASE_TOKEN come back only from get_secret, behind the credentials:reveal scope, and the tool tells the client never to go after them unless you asked for that exact value. See Which database your site has.

Inputs

Input Type Required Description
projectId string Yes The site id.