Going through the git history the existing logic of "dont do this if
it's already selected" was just for audio or video QOL enhancements to
not stop playing when the same conversation is selected.
- [x] Implement batch migration of attachments without index, i.e. use default
primary key index on `Message::id`.
- [x] Run attachment in background without index.
- [x] Prepare module for whole database migrations in the future. Once we enable
that, we have to force (remaining) attachment migration upon startup.
- [x] Run migrations explicitly on startup and remove implicit migrations from
Backbone models using a placeholder that throws an error.
- [x] `Signal.Debug`: Add support for generating real-world data for
benchmarking based on contents in `fixtures` folder. Add additional files
to create a larger variety of test cases, e.g. JPEG, PNG, GIF, MP4, TXT,
etc. **Test command:**
```
Signal.Debug.createConversation({
ConversationController,
WhisperMessage: Whisper.Message,
numMessages: 100,
});
```
- [x] Minor: Improve error message for `storage.fetch` failures.
- [x] Minor: Use ISO-8601 timestamp for key rotation (helped me debug an issue).
- [x] Update tests to explicitly run migrations.
Previously, this was formatted using locale specific settings. This will allow
easier debugging by matching key rotation timestamps against log timestamps.
Introduce placeholder migrations for Backbone models so they never implicitly
run migrations whenever they are `fetch`ed. We prefer to run our migrations
explicitly upon app startup and then let Backbone models be (slightly) dumb(er)
models, without inadvertently triggering migrations.
- [x] Run initial Backbone migrations 12–17 upon startup.
- [x] ~~Run attachment migration (without Backbone references to avoid
migrations): `MessageDataMigrator.processAll`.~~ Disabled in favor of
background processing without index.
- [x] ~~Run new migrations that can cover entire database (18+).~~
Not until we have such migrations.
- [x] Add `runMigrations` module that ensures migrations are only run once.
- [x] Add `settings` (`Signal.Settings`) module to interact with our app
settings (`items` store) using a domain API, e.g.
`isAttachmentMigrationComplete(…)` vs
`storage.get('attachmentMigration_isComplete')`. Required to check
attachment migration status without using Backbone.
- [x] Add `database` (`Signal.Database`) CommonJS module to provide
`Promise`-based interface to IndexedDB.
- [x] Add `debug` (`Signal.Debug`) module for generating synthetic data to test
performance of migration.
- [x] Minor: Add `sleep` module for doing promise based sleeps.
- [x] Minor: Extract `wrapDeferred` as CommonJS module named `deferredToPromise`.