Open michielbdejong opened 2 years ago
Maybe there needs to be a layer just below "command", where the command issued by the user has already been translated to an action, e.g. decision about access control, filling in default values if values are missing, and e.g. applying the context wrt user and server mode, etc.
Also, don't need to include the read commands.
At some level, we could save the SQL logs of course! :)
Will think about it some more.
Maybe we should rethink reset script vs idempotent pull and truth in db or in source docs.
The way the Nextcloud app currently works, it doesn't keep track of which source documents led to the current db state. That means the db state is not ephemeral.
That is different from how time-pondersource-com works right now, because there the production db is ephemeral and the truth is in the source documents which we keep in a private git repo that exists specifically for this purpose.
We could leave this as two ways to use PreJournal, but it would maybe be an improvement if PreJournal had a replayable command log. The nice thing is we already have each write action, no matter what triggers it, go through the runCommand function, where the command is represented as an array of up to 8 strings, so it would be pretty easy to store that in a database table and then have a "replay log" meta-command.