table.fields
Lists the fields of one of the model's tables.
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.fields(tableName)Parameters
| Parameter | Type | Description |
|---|---|---|
tableName | string | The table's name or id. |
Returns
string | nullThe fields, as a JSON array string, each with its id, name and type. Use JSON.parse() to read it. Returns null when the table can't be found.
Examples
js
const fields = JSON.parse(table.fields("users"));