Expected behavior
Being able to research a user
Actual behavior
Server error
I can filter my data by id and I can order the view by id
Failure Logs
While using the research function on the user table I have that error :
2|admin | [forest] 🌳🌳🌳 Unexpected error: function lower(uuid) does not exist
2|admin | SequelizeDatabaseError: function lower(uuid) does not exist
2|admin | at Query.formatError (/home/ubuntu/releases/20210305201057/forest-admin/node_modules/sequelize/lib/dialects/postgres/query.js:386:16)
2|admin | at Query.run (/home/ubuntu/releases/20210305201057/forest-admin/node_modules/sequelize/lib/dialects/postgres/query.js:87:18)
2|admin | at processTicksAndRejections (internal/process/task_queues.js:93:5)
2|admin | at async /home/ubuntu/releases/20210305201057/forest-admin/node_modules/sequelize/lib/sequelize.js:619:16
2|admin | at async PostgresQueryInterface.rawSelect (/home/ubuntu/releases/20210305201057/forest-admin/node_modules/sequelize/lib/dialects/abstract/query-interface.js:994:18)
2|admin | at async Function.aggregate (/home/ubuntu/releases/20210305201057/forest-admin/node_modules/sequelize/lib/model.js:1986:19)
2|admin | at async Function.count (/home/ubuntu/releases/20210305201057/forest-admin/node_modules/sequelize/lib/model.js:2037:12)
My table definition is
const User = sequelize.define(
'users',
{
id: {
type: DataTypes.UUID,
primaryKey: true,
defaultValue: Sequelize.literal('uuid_generate_v4()'),
allowNull: false,
},
email: {
type: DataTypes.STRING,
},
firstname: {
type: DataTypes.STRING,
defaultValue: '',
validate: {
is: /^[a-zA-Z\p{L}' -]*$/u,
},
// This is needed to set empty strings. (see https://community.forestadmin.com/t/cant-save-not-null-fields-with-empty-strings/1091/3.)
set(val) {
this.setDataValue('firstname', val || '');
},
},
},
{
tableName: 'users',
underscored: true,
timestamps: false,
schema: process.env.DATABASE_SCHEMA,
},
);
It is linked to two other tables :
User.associate = (models) => {
User.belongsTo(models.accounts);
User.hasMany(models.consents, {
foreignKey: 'created_by_user_id',
as: 'authoredConsent',
});
User.belongsToMany(models.patients, { through: models.consents });
User.belongsToMany(models.locations, { through: models.locationsUsers, foreignKey: 'user_id', otherKey: 'location_id' });
};
and it has a beforeUpdate rule that does not use the id.
I don’t have the problem with any of my other tables
Context
Please provide any relevant information about your setup.
- Package Version:3.10.9 (lumber cli)
- Express Version:7.9.6
- Sequelize Version: 6.7.7
- Database Dialect: postgresql
- Database Version:0.0.1
- Project Name: Darwin