Database Developer
getConfig()
Get an environment configuration database schema. The database schema is the definition of the structure of your database.
const response = client.db.getConfig({
appId: 'YOUR_APP_ID',
appEnv: 'YOUR_APP_ENV',
});
Parameters
Parameter | Description |
---|---|
appId | The application ID. |
appEnv | The application environment. |
See: getConfig
, DBConfigSchema
updateConfig()
Update an environment configuration database schema. This process will create
a migration under the hood and will delete data. It should be used carefully.
It's not possible to update your production
environment with this method.
const response = client.db.updateConfig({
appId: 'YOUR_APP_ID',
appEnv: 'YOUR_APP_ENV',
config: 'YOUR_SERALIALIZED_CONFIG',
});
Parameters
Parameter | Description |
---|---|
appId | The application ID. |
appEnv | The application environment. |
config | The serialized configuration schema. |
See: updateConfig
, DBConfigSchema
createEnv()
const response = await client.db.createEnv({
appId: 'YOUR_APP_ID',
newEnv: 'YOUR_NEW_ENV_NAME',
fromEnv: 'YOUR_BASE_ENV_NAME',
});
Create a new environment for a database from another environment. If The
fromEnv
argument is not provided, production
will be used by default.
Parameters
Parameter | Description |
---|---|
appId | The application ID. |
newEnv | The name of the new application environment. |
fromEnv | The name of the parent application environment (default: "production"). |
See: createEnv
, DBConfigSchema
deleteEnv()
Delete a database environment for an application.
Parameters
Parameter | Description |
---|---|
appId | The application ID. |
environment | The application environment to delete. |
See: deleteEnv
diff()
client.db.diff(arg: |
| { appId: string, appEnv: string, config: string }
| { appId: string, currEnv: string, nextEnv: string }
): Promise<{
currEnv: string,
nextEnv: string | null,
current: DBConfigSchema,
next: DBConfigSchema,
diff: DBLevelDiffSchema,
hash: string,
}>;
Generate a diff between database configuration schemas. This method can be used to compare two existant environments or an existant environment with a live configuration schema.
Parameters
Parameter | Description |
---|---|
appId | The application ID. |
appEnv | The application environment to compare. |
config | The database configuration. |
appId | The application ID. |
currEnv | The application environment to compare as current configuration. |
nextEnv | The application environment to compare as next configuration. |
See: DBConfigSchema
, DBLevelDiffSchema
migrate()
client.db.migrate(arg: {
appId: string,
currEnv: string,
nextEnv: string,
hash: string,
}): Promise<DBConfigSchema>;
Migration is the process that allows you to modify a database configuration securely. Since a diff hash is required, you have the option to validate the difference between the two configurations before applying it.
See: DBConfigSchema