gristlabs_grist-core/sandbox
Jarosław Sadziński 1d2cf3de49 (core) Adding backend for 2-way references
Summary:
Adding support for 2-way references in data engine.

- Columns have an `reverseCol` field, which says "this is a reverse of the given column, update me when that one changes".
- At the time of setting `reverseCol`, we ensure that it's symmetrical to make a 2-way reference.
- Elsewhere we just implement syncing in one direction:
  - When `reverseCol` is present, user code is generated with a type like `grist.ReferenceList("Tasks", reverse_of="Assignee")`
  - On updating a ref column, we use `prepare_new_values()` method to generate corresponding updates to any column that's a reverse of it.
  - The `prepare_new_values()` approach is extended to support this.
  - We don't add (or remove) any mappings between rows, and rely on existing mappings (in a ref column's `_relation`) to create reverse updates.

NOTE This is polished version of https://phab.getgrist.com/D4307 with tests and 3 bug fixes
- Column transformation didn't work when transforming RefList to Ref, the reverse column became out of sync
- Tables with reverse columns couldn't be removed
- Setting json arrays to RefList didn't work if arrays contained other things besides ints
Those fixes are covered by new tests.

Test Plan: New tests

Reviewers: georgegevoian, paulfitz, dsagal

Reviewed By: georgegevoian, paulfitz

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D4322
2024-09-11 22:31:36 +02:00
..
docker (core) Upgrade to Python 3.11 2023-08-04 18:19:40 +02:00
grist (core) Adding backend for 2-way references 2024-09-11 22:31:36 +02:00
gvisor Check gvisor on startup of run.sh, and clean up scripts related to gvisor flags (#760) 2023-11-27 16:20:43 -05:00
pyodide fix shebang in various bash scripts (#910) 2024-03-25 09:55:20 -04:00
bundle_as_wheel.sh fix shebang in various bash scripts (#910) 2024-03-25 09:55:20 -04:00
docker_entrypoint.sh Adds a home directory for non-root docker user in container (#1109) 2024-07-16 22:35:27 +01:00
gen_js_schema.py add a script for copying schema information from python to typescript 2023-01-17 15:54:41 -05:00
install_tz.js (core) apply some dependabot suggestions 2022-09-07 14:15:34 -04:00
MANIFEST.in support other SQLite wrappers, and various hooks needed by grist-static (#516) 2023-05-23 15:17:28 -04:00
requirements3.in (core) Upgrade to Python 3.11 2023-08-04 18:19:40 +02:00
requirements3.txt (core) Fix updating attributes inside f-strings when columns are renamed 2023-09-11 14:41:30 +02:00
requirements.txt (core) Fix updating attributes inside f-strings when columns are renamed 2023-09-11 14:41:30 +02:00
run.sh Fix docker graceful shutdown (#830) 2024-01-30 10:00:59 -05:00
setup.py support other SQLite wrappers, and various hooks needed by grist-static (#516) 2023-05-23 15:17:28 -04:00
supervisor.mjs restart: gracefully handle restart failure 2024-07-30 13:41:47 -04:00
watch.sh reconcile boot and admin pages further (#963) 2024-05-23 16:40:31 -04:00