Naming conflicts
const { createAgent } = require('@forestadmin/agent');
const { createSqlDataSource } = require('@forestadmin/datasource-sql');
const agent = createAgent(options);
const sqlDataSource = createSqlDataSource('postgres://user:pass@localhost:5432/mySchema');
// Rename sqlDataSource collections by providing replacements
agent
// Rename the `customers` and `stores` collections.
// Note that other collections won't be renamed.
.addDataSource(sqlDataSource, {
rename: {
customers: 'customersFromFrenchBranch',
stores: 'storesFromFrenchBranch',
},
})
// Renaming can also be done by providing a function.
// All collections will be renamed (the handler is called once per collection)
.addDataSource(sqlDataSource, { rename: name => `${name}FromSpanishBranch` });Last updated