I have a model profile with a hasMany relationship to a Enrolment model, it works fine when I retrieve the profile data with the enrolments records, but when I tried to update the Profile record, I’m getting this error:
code: "42703"
details: null
hint: null
message: "column _.enrolments does not exist"
As a workaround I've added this code to the Application serializer:
export default class ApplicationSerializer extends SupabaseSerializer {
serialize(snapshot, options) {
let json = super.serialize(...arguments);
snapshot.eachRelationship((key, relationship) => {
if (relationship.kind === 'hasMany') {
delete json[key];
}
});
return json;
}
}
I think it would worthy to add this as the default behaviour, as it seems Supabase doesn't handle the relationship field send by the Serializer.
I have a model profile with a hasMany relationship to a Enrolment model, it works fine when I retrieve the profile data with the enrolments records, but when I tried to update the Profile record, I’m getting this error:
As a workaround I've added this code to the Application serializer:
I think it would worthy to add this as the default behaviour, as it seems Supabase doesn't handle the relationship field send by the Serializer.