🐛 Bug: Link record between Atbl Imported & local table fails
Please confirm if bug report does NOT exists already ?
- [X] I confirm there is no existing issue for this
Steps to reproduce ?
Reported by discord user, reproducible when tried on staging https://discord.com/channels/661905455894888490/661905455894888493/1207542892671930423
-
Records are getting linked, but there is an issue when executing the
updateLastModifiedfunction inBaseModelSqlv2class. -
If we try adding link from local table
{
"message": "The column 'id' does not exist.",
"type": "COLUMN_NOT_EXIST",
"extra": {
"column": "id"
},
"info": {
"message": "update \"pf4o1rmzaiv4wy0\".\"Producer_2\" set \"updated_at\" = '2024-02-15 05:16:00+00:00', \"updated_by\" = 'uspck40ftp1krcsk' where (\"id\" = 'rec7CflqABElKe2iz') - column \"id\" does not exist",
"code": "42703"
}
}
- If we try adding link from airtable imported table which has composite key
{
"message": "The column 'ncRecordId' does not exist.",
"type": "COLUMN_NOT_EXIST",
"extra": {
"column": "ncRecordId"
},
"info": {
"message": "update \"pf4o1rmzaiv4wy0\".\"Table-1\" set \"updated_at\" = '2024-02-15 05:28:20+00:00', \"updated_by\" = 'uspck40ftp1krcsk' where (\"ncRecordId\" = '2') - column \"ncRecordId\" does not exist",
"code": "42703"
}
}
Desired Behavior
should be able to create links
Project Details
0.204.0
Attachments
No response
Linking failed: The column 'ncRecordId' does not exist.
@pranavxc this is the same issue we discussed earlier
- After links are getting added we updating column last modified both child and parent column
await this.updateLastModified({
model: parentTable,
rowIds: [childId],
cookie,
});
await this.updateLastModified({
model: childTable,
rowIds: [rowId],
cookie,
});
- Inside
updateLastModifiedfunction we doing something like below
for (const rowId of Array.isArray(rowIds) ? rowIds : [rowIds]) {
qb.orWhere(await this._wherePk(rowId));
}
and inside this._wherePk() we using this.model instead of whatever model has been passed as props like parentTable and childTable model this are different
async _wherePk(id) {
await this.model.getColumns();
return _wherePk(this.model.primaryKeys, id);
}
- Last time we tried to fixed this but some other issue occurred, in frontend rows are getting reorderd according to
updated_atbut in frontendadd new record modalis alway open but current row cell changes due to that record are getting added in some different cell
Already fixed in latest develop, earlier it was extracting primary key from wrong table and which caused the issue.