Card belongs to a studyset and carries only its position, a fractional index (last writer wins), so cards can be reordered and bulk imports keep their order. Its content lives in CardRevision rows, which are never updated except to blank them (ADR 0001, rule 2): parents lists the revisions a revision replaces (decided: a list, so a revision with two parents resolves a conflict), authorId the writer, reportId the report it answers once reports exist, and the envelope holds the content. Deciding the list of parents and the position now matters: changing a synced table later locks out older app versions. The migration (created by CLI) only adds: the two tables, an index on spaceId for each (space deletion cascades into them), one for a studyset's cards in order and one for a card's revisions, and the foreign keys, from the space with ON DELETE CASCADE and from the studyset and the card with ON DELETE CASCADE, DEFERRABLE INITIALLY DEFERRED, since synced rows can arrive in any order. The client migration creates the same tables on each device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
21 lines
798 B
Dart
21 lines
798 B
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 '20260930094729362-studysets/migration.dart';
|
|
part '20260930122235111-cards/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 = [
|
|
_Migration20260930094729362_studysets(),
|
|
_Migration20260930122235111_cards(),
|
|
];
|
|
|
|
/// List of all client-side database migration versions.
|
|
static List<String> get versions => migrations.map((m) => m.version).toList();
|
|
}
|