I’m seeking a way to protect from records becoming accidentally unlinked (or at least being able to relink them again).
Let’s say table1 in db1 (table1.db1) is synched as table1 in db2 (table1.db2) and table2.db2 is linked to table1.db2. If table1.db1 gets filtered and synch’ed to table1.db2, the missing records will get unlinked in table2.db2. And I see now way to relink them again easily.
Is there some way to store the record ID of a linked record in table1 within the linked record in table2 (e.g., with a script)? This would then make it possible to at least repair the links after they’ve been broken (and after fixing the filter in table1.db1).
Assuming the linked records have unique titles, the easiest way to back up the link values, by far, would be to simply copy and paste the values of the linked record fields into a single-line text field. The values in that single-line text field can then be copied back into the linked record field and Airtable’s best-effort conversion magic will automatically transform the string into an array of linked record titles, and match those to the record IDs of the linked records for you, restoring the links. (This can also be used in combination with Automations as a way to have formulas auto-populate linked record fields; it is quite lovely behavior.)
If you need to capture the record ID values of the linked records instead, you could get that information with a rollup field. The problem is that in the case you describe, the record ID values could change if the source table is filtered and then synced again. (I haven’t tested this, but it is one of those things where I would not be surprised at all if Airtable did it this way.) Thus, you might not be able to restore using record ID values as opposed to unique title values.
If you need these backups to happen automatically, that is in one sense very easy to do using Airtable automations, but in another sense very hard to do because you would need to configure the automation triggers to prevent the backup from getting deleted when and if the source data get filtered.