Enrich your models
⚠️ This page is relevant only if you installed Forest Admin directly on a database (SQL/Mongodb). If you installed in a Rails/Django/Laravel app, you manage your models like you normally would.
Enrich your models
Declaring a new model
module.exports = (sequelize, DataTypes) => {
const { Sequelize } = sequelize;
const Company = sequelize.define('companies', {
name: {
type: DataTypes.STRING,
},
createdAt: {
type: DataTypes.DATE,
},
...
}, {
tableName: 'companies',
underscored: true,
schema: process.env.DATABASE_SCHEMA,
});
Company.associate = (models) => {
};
return Company;
};Declaring a new field in a model
Managing nested documents in Mongoose

Removing a model
Adding validation to your models




Adding a default value to your models

Adding a hook

Last updated
Was this helpful?