Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change control file metadata #72

Open
samuelstroschein opened this issue Sep 8, 2024 — with Linear · 1 comment
Open

Change control file metadata #72

samuelstroschein opened this issue Sep 8, 2024 — with Linear · 1 comment

Comments

Copy link
Member

Proposal

Find a way to change control file metadata [without snapshotting the file table].

metadata should be change controlled because the outcome can be stark e.g. in the csv app change the unique column from email to something-else

Context

LIXDK-152 added file metadata without capabilities to track changes in the metadata.

File metadata is necessary to establish an app <-> plugin communication. For example, the CSV app (will) leverage(s) the metadata field to set a unique column from the app by prompting the user "what's the unique column in this csv?". The csv plugin then leverages the unique column to track changes, merge, etc.

Copy link
Member Author

samuelstroschein commented Sep 8, 2024

A trivial (and therefore probably correct way) is to store snapshots of the metadata field in the Change table. Apps (and lix itself) can query the Change table for metadata changes.

Saved change schema

const change = {
  "id": "uuid",
  "file_id": "file.id",
  // prefixed with lix for namespacing
  "type": "lix_file_metadata",
  "value": file.metadata
}

Querying file metadata changes

const metadataChanges = await lix.db.query("change")
  .selectAll()
  .where("file_id", "=", file.id)
  .where("type", "=", "lix_file_metadata")
  .execute()

Using the change table internally in lix is further confirmation that LIXDK-106 is the right move. Lix itself will be able to store changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant