Skip to content

table.fieldExists ​

Checks whether one of the model's tables has a field.

TIP

For more control, such as other column types, indexes or keys, manage tables with SQL instead. Run CREATE, ALTER and DROP TABLE statements with DatasourceClient's execute.

js
table.fieldExists(tableName, fieldName)

Parameters ​

ParameterTypeDescription
tableNamestringThe table's name or id.
fieldNamestringThe field's name.

Returns ​

boolean

true if the field exists. false if it doesn't, or the table can't be found.

Examples ​

js
const exists = table.fieldExists("users", "password");