Database
Developer

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

ParameterDescription
appIdThe application ID.
appEnvThe application environment.
🔒
Auth: App Dev

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

ParameterDescription
appIdThe application ID.
appEnvThe application environment.
configThe serialized configuration schema.
🔒
Auth: App Dev

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

ParameterDescription
appIdThe application ID.
newEnvThe name of the new application environment.
fromEnvThe name of the parent application environment (default: "production").
🔒
Auth: App Dev

See: createEnv, DBConfigSchema


deleteEnv()

 

Delete a database environment for an application.

Parameters

ParameterDescription
appIdThe application ID.
environmentThe application environment to delete.
🔒
Auth: App Dev

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,
}>;
🔒
Auth: App Dev

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

ParameterDescription
appIdThe application ID.
appEnvThe application environment to compare.
configThe database configuration.
appIdThe application ID.
currEnvThe application environment to compare as current configuration.
nextEnvThe 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>;
🔒
Auth: App Dev

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