A person's weights are each a sealed `body_weight` row, as the days and
the places: the weight in grams, when it was measured (UTC), where it
came from and, for Health Connect's, the record's id and app are the
payload; the server sees the space and the ciphertext alone.
Progress gets a Weight card after Your body: the latest and its day,
its line over time (held, each weight and its day), the plus to enter
one (a comma taken as a point, 20 to 400 kg, when measured, today by
default) and All, the list to delete one. The latest weight is also
Your body's, which the band's and the zones' figures work from. In
kilograms alone: Train is metric throughout and has no units setting
yet.
Health Connect's weight records are read in when switched on in its
screen (READ_WEIGHT, asked as the others): each record once, its id kept
in health_connect.json also after it is deleted here, never Train's own,
and none within 10 minutes and 0.1 kg of a weight entered in Train.
The migration (20261103204323683-body-weights):
- creates (or replaces, unchanged) `gen_random_uuid_v7()`, the
default of every UUID id, as each of Serverpod's migrations does;
- CREATE TABLE "body_weight": "id" uuid primary key defaulting to a
UUID v7, "spaceId" bigint (the sync space), "keyId" text (the key
that sealed it), "payload" bytea NOT NULL (the sealed content),
"nonce" bytea;
- CREATE INDEX "body_weight_space_idx" on "spaceId", for a space's
rows as the sync reads them;
- a foreign key from "spaceId" to "offline_sync_spaces"("id"),
ON DELETE CASCADE, so that an account's deletion takes its weights
with its space;
- the version rows of Train's and every module's migrations.
Nothing existing changes, so nothing is lost.
Tests: the row written and read back in its owner's space, and the
denials: another person reads none of them, and writing one into
another's space throws OfflineSyncSpaceMembershipException and leaves
it empty; an account's deletion takes them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
33 lines
1.3 KiB
Dart
33 lines
1.3 KiB
Dart
/// AUTOGENERATED BY SERVERPOD create-migration - DO NOT EDIT BY HAND
|
|
/// Merging: resolve registry conflicts the same as migration_registry.txt.
|
|
library;
|
|
|
|
import 'package:serverpod_database/serverpod_database.dart';
|
|
|
|
part '20261028101012641-workouts/migration.dart';
|
|
part '20261028164640000-profile/migration.dart';
|
|
part '20261028181405893-days/migration.dart';
|
|
part '20261028211508606-plans/migration.dart';
|
|
part '20261028231042668-routes/migration.dart';
|
|
part '20261102103211357-training-places/migration.dart';
|
|
part '20261102113104496-strength-plans/migration.dart';
|
|
part '20261103204323683-body-weights/migration.dart';
|
|
|
|
/// Migration registry for the client-side database.
|
|
class MigrationRegistry {
|
|
/// Ordered list of all client-side database migrations.
|
|
/// New migrations are always appended at the end.
|
|
static final List<MigrationVersionSql> migrations = [
|
|
_Migration20261028101012641_workouts(),
|
|
_Migration20261028164640000_profile(),
|
|
_Migration20261028181405893_days(),
|
|
_Migration20261028211508606_plans(),
|
|
_Migration20261028231042668_routes(),
|
|
_Migration20261102103211357_training_places(),
|
|
_Migration20261102113104496_strength_plans(),
|
|
_Migration20261103204323683_body_weights(),
|
|
];
|
|
|
|
/// List of all client-side database migration versions.
|
|
static List<String> get versions => migrations.map((m) => m.version).toList();
|
|
}
|