Create the site database
create_site_database
Gives a site a database if it does not have one yet.
This is what turns a site with no data layer into one that can hold collections. Calling it on a site that already has a database is harmless and reports the one that is there, so it is safe to call before any other data tool. created says whether this call made the database.
The engine is chosen for the site, not by the client. A site that has never had a database gets the newer database, however old the site is and however it was made, and it is ready as soon as the call returns. On the older database the response can come back with ready false, in which case read get_site_database until it is ready.
The engine comes back in the database type field, so read it before writing SQL. As with get_site_database, the connection string, host, user and password are never returned. See Getting a database.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
projectId |
string | Yes | The site id. |