mod.rs (52074B)
1 //! Versioned schema authority for `runtime.sqlite`. 2 //! 3 //! The public descriptor surface exposes version and integrity metadata only. 4 //! Embedded SQL remains an implementation detail of this backend. 5 6 /// Lowest runtime schema version this package can recognize. 7 pub const MINIMUM_VERSION: u32 = 1; 8 /// Current runtime schema version created by this package. 9 pub const CURRENT_VERSION: u32 = 17; 10 11 const RUNTIME_V1_SQL: &str = include_str!("0001_runtime.up.sql"); 12 const CANONICAL_EVENT_STORAGE_V2_SQL: &str = include_str!("0002_canonical_event_storage.up.sql"); 13 const OPERATION_JOURNAL_V3_SQL: &str = include_str!("0003_operation_journal.up.sql"); 14 const OUTBOX_DELIVERY_EVIDENCE_V4_SQL: &str = include_str!("0004_outbox_delivery_evidence.up.sql"); 15 const PROJECTION_METADATA_V5_SQL: &str = include_str!("0005_projection_metadata.up.sql"); 16 const LEGACY_IMPORT_JOURNAL_V6_SQL: &str = include_str!("0006_legacy_import_journal.up.sql"); 17 const LEGACY_EVENT_STAGING_V7_SQL: &str = include_str!("0007_legacy_event_staging.up.sql"); 18 const LEGACY_OUTBOX_STAGING_V8_SQL: &str = include_str!("0008_legacy_outbox_staging.up.sql"); 19 const LEGACY_IMPORT_COMMITS_V9_SQL: &str = include_str!("0009_legacy_import_commits.up.sql"); 20 const PROJECTION_REBUILD_SOURCE_BINDING_V10_SQL: &str = 21 include_str!("0010_projection_rebuild_source_binding.up.sql"); 22 const AUTHORED_OPERATIONS_V11_SQL: &str = include_str!("0011_authored_operations.up.sql"); 23 const MATERIALIZED_PROJECTION_DOCUMENTS_V12_SQL: &str = 24 include_str!("0012_materialized_projection_documents.up.sql"); 25 const AUTHORED_DRAFT_REVISIONS_V13_SQL: &str = include_str!("0013_authored_draft_revisions.up.sql"); 26 27 const AUTHORED_DRAFT_QUERY_V14_SQL: &str = 28 include_str!("0014_authored_draft_query_metadata.up.sql"); 29 const AUTHORED_SIGNED_FACTS_V15_SQL: &str = include_str!("0015_authored_signed_facts.up.sql"); 30 31 const AUTHORED_DELIVERY_FACTS_V16_SQL: &str = include_str!("0016_authored_delivery_facts.up.sql"); 32 33 const AUTHORED_DELIVERY_RECONCILIATION_V17_SQL: &str = 34 include_str!("0017_authored_delivery_reconciliation.up.sql"); 35 36 /// Stable, non-SQL description of one forward runtime migration. 37 #[derive(Clone, Copy, Debug, Eq, PartialEq)] 38 pub struct MigrationDescriptor { 39 version: u32, 40 name: &'static str, 41 up_sha256: &'static str, 42 owned_objects: &'static [&'static str], 43 } 44 45 impl MigrationDescriptor { 46 /// Returns the positive, monotonically increasing migration version. 47 pub const fn version(self) -> u32 { 48 self.version 49 } 50 51 /// Returns the stable migration name. 52 pub const fn name(self) -> &'static str { 53 self.name 54 } 55 56 /// Returns the lowercase SHA-256 of the exact embedded migration bytes. 57 pub const fn up_sha256(self) -> &'static str { 58 self.up_sha256 59 } 60 61 /// Returns the complete, sorted SQLite catalog owned after this migration. 62 pub const fn owned_objects(self) -> &'static [&'static str] { 63 self.owned_objects 64 } 65 } 66 67 const RUNTIME_V1_OBJECTS: &[&str] = &[ 68 "radroots_runtime_atomic_commits", 69 "radroots_runtime_delivery_evidence", 70 "radroots_runtime_delivery_evidence_item_idx", 71 "radroots_runtime_event_index_checkpoints", 72 "radroots_runtime_event_index_manifests", 73 "radroots_runtime_event_index_shards", 74 "radroots_runtime_event_provenance", 75 "radroots_runtime_event_provenance_observed_idx", 76 "radroots_runtime_events", 77 "radroots_runtime_events_admission_idx", 78 "radroots_runtime_events_delete_guard", 79 "radroots_runtime_events_event_id_idx", 80 "radroots_runtime_events_raw_update_guard", 81 "radroots_runtime_journal_idempotency_idx", 82 "radroots_runtime_journal_operations", 83 "radroots_runtime_journal_recovery_idx", 84 "radroots_runtime_outbox_items", 85 "radroots_runtime_outbox_ready_idx", 86 "radroots_runtime_outbox_targets", 87 "radroots_runtime_projection_checkpoints", 88 "radroots_runtime_projection_invalidations", 89 "radroots_runtime_projection_rebuilds", 90 "radroots_runtime_projection_rebuilds_stage_idx", 91 "radroots_runtime_source_generations", 92 "radroots_runtime_source_generations_delete_guard", 93 "radroots_runtime_source_generations_identity_guard", 94 ]; 95 96 const RUNTIME_V2_OBJECTS: &[&str] = &[ 97 "radroots_runtime_atomic_commits", 98 "radroots_runtime_delivery_evidence", 99 "radroots_runtime_delivery_evidence_item_idx", 100 "radroots_runtime_event_index_checkpoints", 101 "radroots_runtime_event_index_manifests", 102 "radroots_runtime_event_index_shards", 103 "radroots_runtime_event_provenance", 104 "radroots_runtime_event_provenance_observed_idx", 105 "radroots_runtime_events", 106 "radroots_runtime_events_admission_idx", 107 "radroots_runtime_events_delete_guard", 108 "radroots_runtime_events_event_id_idx", 109 "radroots_runtime_events_raw_update_guard", 110 "radroots_runtime_journal_idempotency_idx", 111 "radroots_runtime_journal_operations", 112 "radroots_runtime_journal_recovery_idx", 113 "radroots_runtime_outbox_items", 114 "radroots_runtime_outbox_ready_idx", 115 "radroots_runtime_outbox_targets", 116 "radroots_runtime_projection_checkpoints", 117 "radroots_runtime_projection_invalidations", 118 "radroots_runtime_projection_rebuilds", 119 "radroots_runtime_projection_rebuilds_stage_idx", 120 "radroots_runtime_source_generations", 121 "radroots_runtime_source_generations_active_idx", 122 "radroots_runtime_source_generations_delete_guard", 123 "radroots_runtime_source_generations_identity_guard", 124 "radroots_runtime_source_generations_sequence_guard", 125 ]; 126 127 const RUNTIME_V4_OBJECTS: &[&str] = &[ 128 "radroots_runtime_atomic_commits", 129 "radroots_runtime_delivery_evidence", 130 "radroots_runtime_delivery_evidence_item_idx", 131 "radroots_runtime_event_index_checkpoints", 132 "radroots_runtime_event_index_manifests", 133 "radroots_runtime_event_index_shards", 134 "radroots_runtime_event_provenance", 135 "radroots_runtime_event_provenance_observed_idx", 136 "radroots_runtime_events", 137 "radroots_runtime_events_admission_idx", 138 "radroots_runtime_events_delete_guard", 139 "radroots_runtime_events_event_id_idx", 140 "radroots_runtime_events_raw_update_guard", 141 "radroots_runtime_journal_idempotency_idx", 142 "radroots_runtime_journal_operations", 143 "radroots_runtime_journal_recovery_idx", 144 "radroots_runtime_outbox_items", 145 "radroots_runtime_outbox_operation_idx", 146 "radroots_runtime_outbox_ready_idx", 147 "radroots_runtime_outbox_targets", 148 "radroots_runtime_projection_checkpoints", 149 "radroots_runtime_projection_invalidations", 150 "radroots_runtime_projection_rebuilds", 151 "radroots_runtime_projection_rebuilds_stage_idx", 152 "radroots_runtime_source_generations", 153 "radroots_runtime_source_generations_active_idx", 154 "radroots_runtime_source_generations_delete_guard", 155 "radroots_runtime_source_generations_identity_guard", 156 "radroots_runtime_source_generations_sequence_guard", 157 ]; 158 159 const RUNTIME_V6_OBJECTS: &[&str] = &[ 160 "radroots_runtime_atomic_commits", 161 "radroots_runtime_delivery_evidence", 162 "radroots_runtime_delivery_evidence_item_idx", 163 "radroots_runtime_event_index_checkpoints", 164 "radroots_runtime_event_index_manifests", 165 "radroots_runtime_event_index_shards", 166 "radroots_runtime_event_provenance", 167 "radroots_runtime_event_provenance_observed_idx", 168 "radroots_runtime_events", 169 "radroots_runtime_events_admission_idx", 170 "radroots_runtime_events_delete_guard", 171 "radroots_runtime_events_event_id_idx", 172 "radroots_runtime_events_raw_update_guard", 173 "radroots_runtime_journal_idempotency_idx", 174 "radroots_runtime_journal_operations", 175 "radroots_runtime_journal_recovery_idx", 176 "radroots_runtime_legacy_import_delete_guard", 177 "radroots_runtime_legacy_import_identity_guard", 178 "radroots_runtime_legacy_import_member_delete_guard", 179 "radroots_runtime_legacy_import_member_identity_guard", 180 "radroots_runtime_legacy_import_member_state_guard", 181 "radroots_runtime_legacy_import_members", 182 "radroots_runtime_legacy_import_state_guard", 183 "radroots_runtime_legacy_import_state_idx", 184 "radroots_runtime_legacy_imports", 185 "radroots_runtime_outbox_items", 186 "radroots_runtime_outbox_operation_idx", 187 "radroots_runtime_outbox_ready_idx", 188 "radroots_runtime_outbox_targets", 189 "radroots_runtime_projection_checkpoints", 190 "radroots_runtime_projection_invalidations", 191 "radroots_runtime_projection_rebuilds", 192 "radroots_runtime_projection_rebuilds_stage_idx", 193 "radroots_runtime_source_generations", 194 "radroots_runtime_source_generations_active_idx", 195 "radroots_runtime_source_generations_delete_guard", 196 "radroots_runtime_source_generations_identity_guard", 197 "radroots_runtime_source_generations_sequence_guard", 198 ]; 199 200 const RUNTIME_V7_OBJECTS: &[&str] = &[ 201 "radroots_runtime_atomic_commits", 202 "radroots_runtime_delivery_evidence", 203 "radroots_runtime_delivery_evidence_item_idx", 204 "radroots_runtime_event_index_checkpoints", 205 "radroots_runtime_event_index_manifests", 206 "radroots_runtime_event_index_shards", 207 "radroots_runtime_event_provenance", 208 "radroots_runtime_event_provenance_observed_idx", 209 "radroots_runtime_events", 210 "radroots_runtime_events_admission_idx", 211 "radroots_runtime_events_delete_guard", 212 "radroots_runtime_events_event_id_idx", 213 "radroots_runtime_events_raw_update_guard", 214 "radroots_runtime_journal_idempotency_idx", 215 "radroots_runtime_journal_operations", 216 "radroots_runtime_journal_recovery_idx", 217 "radroots_runtime_legacy_event_staging", 218 "radroots_runtime_legacy_event_staging_delete_guard", 219 "radroots_runtime_legacy_event_staging_insert_guard", 220 "radroots_runtime_legacy_event_staging_update_guard", 221 "radroots_runtime_legacy_import_delete_guard", 222 "radroots_runtime_legacy_import_identity_guard", 223 "radroots_runtime_legacy_import_member_delete_guard", 224 "radroots_runtime_legacy_import_member_identity_guard", 225 "radroots_runtime_legacy_import_member_state_guard", 226 "radroots_runtime_legacy_import_members", 227 "radroots_runtime_legacy_import_state_guard", 228 "radroots_runtime_legacy_import_state_idx", 229 "radroots_runtime_legacy_imports", 230 "radroots_runtime_outbox_items", 231 "radroots_runtime_outbox_operation_idx", 232 "radroots_runtime_outbox_ready_idx", 233 "radroots_runtime_outbox_targets", 234 "radroots_runtime_projection_checkpoints", 235 "radroots_runtime_projection_invalidations", 236 "radroots_runtime_projection_rebuilds", 237 "radroots_runtime_projection_rebuilds_stage_idx", 238 "radroots_runtime_source_generations", 239 "radroots_runtime_source_generations_active_idx", 240 "radroots_runtime_source_generations_delete_guard", 241 "radroots_runtime_source_generations_identity_guard", 242 "radroots_runtime_source_generations_sequence_guard", 243 ]; 244 245 const RUNTIME_V8_OBJECTS: &[&str] = &[ 246 "radroots_runtime_atomic_commits", 247 "radroots_runtime_delivery_evidence", 248 "radroots_runtime_delivery_evidence_item_idx", 249 "radroots_runtime_event_index_checkpoints", 250 "radroots_runtime_event_index_manifests", 251 "radroots_runtime_event_index_shards", 252 "radroots_runtime_event_provenance", 253 "radroots_runtime_event_provenance_observed_idx", 254 "radroots_runtime_events", 255 "radroots_runtime_events_admission_idx", 256 "radroots_runtime_events_delete_guard", 257 "radroots_runtime_events_event_id_idx", 258 "radroots_runtime_events_raw_update_guard", 259 "radroots_runtime_journal_idempotency_idx", 260 "radroots_runtime_journal_operations", 261 "radroots_runtime_journal_recovery_idx", 262 "radroots_runtime_legacy_event_staging", 263 "radroots_runtime_legacy_event_staging_delete_guard", 264 "radroots_runtime_legacy_event_staging_insert_guard", 265 "radroots_runtime_legacy_event_staging_update_guard", 266 "radroots_runtime_legacy_import_delete_guard", 267 "radroots_runtime_legacy_import_identity_guard", 268 "radroots_runtime_legacy_import_member_delete_guard", 269 "radroots_runtime_legacy_import_member_identity_guard", 270 "radroots_runtime_legacy_import_member_state_guard", 271 "radroots_runtime_legacy_import_members", 272 "radroots_runtime_legacy_import_state_guard", 273 "radroots_runtime_legacy_import_state_idx", 274 "radroots_runtime_legacy_imports", 275 "radroots_runtime_legacy_outbox_staging", 276 "radroots_runtime_legacy_outbox_staging_delete_guard", 277 "radroots_runtime_legacy_outbox_staging_insert_guard", 278 "radroots_runtime_legacy_outbox_staging_parent_idx", 279 "radroots_runtime_legacy_outbox_staging_update_guard", 280 "radroots_runtime_outbox_items", 281 "radroots_runtime_outbox_operation_idx", 282 "radroots_runtime_outbox_ready_idx", 283 "radroots_runtime_outbox_targets", 284 "radroots_runtime_projection_checkpoints", 285 "radroots_runtime_projection_invalidations", 286 "radroots_runtime_projection_rebuilds", 287 "radroots_runtime_projection_rebuilds_stage_idx", 288 "radroots_runtime_source_generations", 289 "radroots_runtime_source_generations_active_idx", 290 "radroots_runtime_source_generations_delete_guard", 291 "radroots_runtime_source_generations_identity_guard", 292 "radroots_runtime_source_generations_sequence_guard", 293 ]; 294 295 const RUNTIME_V9_OBJECTS: &[&str] = &[ 296 "radroots_runtime_atomic_commits", 297 "radroots_runtime_delivery_evidence", 298 "radroots_runtime_delivery_evidence_item_idx", 299 "radroots_runtime_event_index_checkpoints", 300 "radroots_runtime_event_index_manifests", 301 "radroots_runtime_event_index_shards", 302 "radroots_runtime_event_provenance", 303 "radroots_runtime_event_provenance_observed_idx", 304 "radroots_runtime_events", 305 "radroots_runtime_events_admission_idx", 306 "radroots_runtime_events_delete_guard", 307 "radroots_runtime_events_event_id_idx", 308 "radroots_runtime_events_raw_update_guard", 309 "radroots_runtime_journal_idempotency_idx", 310 "radroots_runtime_journal_operations", 311 "radroots_runtime_journal_recovery_idx", 312 "radroots_runtime_legacy_event_staging", 313 "radroots_runtime_legacy_event_staging_delete_guard", 314 "radroots_runtime_legacy_event_staging_insert_guard", 315 "radroots_runtime_legacy_event_staging_update_guard", 316 "radroots_runtime_legacy_import_commit_delete_guard", 317 "radroots_runtime_legacy_import_commit_update_guard", 318 "radroots_runtime_legacy_import_commits", 319 "radroots_runtime_legacy_import_delete_guard", 320 "radroots_runtime_legacy_import_identity_guard", 321 "radroots_runtime_legacy_import_member_delete_guard", 322 "radroots_runtime_legacy_import_member_identity_guard", 323 "radroots_runtime_legacy_import_member_state_guard", 324 "radroots_runtime_legacy_import_members", 325 "radroots_runtime_legacy_import_state_guard", 326 "radroots_runtime_legacy_import_state_idx", 327 "radroots_runtime_legacy_imports", 328 "radroots_runtime_legacy_outbox_staging", 329 "radroots_runtime_legacy_outbox_staging_delete_guard", 330 "radroots_runtime_legacy_outbox_staging_insert_guard", 331 "radroots_runtime_legacy_outbox_staging_parent_idx", 332 "radroots_runtime_legacy_outbox_staging_update_guard", 333 "radroots_runtime_outbox_items", 334 "radroots_runtime_outbox_operation_idx", 335 "radroots_runtime_outbox_ready_idx", 336 "radroots_runtime_outbox_targets", 337 "radroots_runtime_projection_checkpoints", 338 "radroots_runtime_projection_invalidations", 339 "radroots_runtime_projection_rebuilds", 340 "radroots_runtime_projection_rebuilds_stage_idx", 341 "radroots_runtime_source_generations", 342 "radroots_runtime_source_generations_active_idx", 343 "radroots_runtime_source_generations_delete_guard", 344 "radroots_runtime_source_generations_identity_guard", 345 "radroots_runtime_source_generations_sequence_guard", 346 ]; 347 348 const RUNTIME_V11_OBJECTS: &[&str] = &[ 349 "radroots_runtime_atomic_commits", 350 "radroots_runtime_authored_artifacts", 351 "radroots_runtime_authored_artifacts_admission_ready_idx", 352 "radroots_runtime_authored_artifacts_signing_ready_idx", 353 "radroots_runtime_authored_atomic_commits", 354 "radroots_runtime_authored_atomic_commits_delete_guard", 355 "radroots_runtime_authored_atomic_commits_update_guard", 356 "radroots_runtime_authored_delivery_attempts", 357 "radroots_runtime_authored_delivery_plans", 358 "radroots_runtime_authored_delivery_ready_idx", 359 "radroots_runtime_authored_delivery_targets", 360 "radroots_runtime_authored_migration_evidence", 361 "radroots_runtime_authored_migration_evidence_delete_guard", 362 "radroots_runtime_authored_migration_evidence_update_guard", 363 "radroots_runtime_authored_operations", 364 "radroots_runtime_delivery_evidence", 365 "radroots_runtime_delivery_evidence_item_idx", 366 "radroots_runtime_event_index_checkpoints", 367 "radroots_runtime_event_index_manifests", 368 "radroots_runtime_event_index_shards", 369 "radroots_runtime_event_provenance", 370 "radroots_runtime_event_provenance_observed_idx", 371 "radroots_runtime_events", 372 "radroots_runtime_events_admission_idx", 373 "radroots_runtime_events_contract_metadata_guard", 374 "radroots_runtime_events_contract_metadata_insert_guard", 375 "radroots_runtime_events_delete_guard", 376 "radroots_runtime_events_event_id_idx", 377 "radroots_runtime_events_raw_update_guard", 378 "radroots_runtime_journal_idempotency_idx", 379 "radroots_runtime_journal_operations", 380 "radroots_runtime_journal_recovery_idx", 381 "radroots_runtime_legacy_event_staging", 382 "radroots_runtime_legacy_event_staging_delete_guard", 383 "radroots_runtime_legacy_event_staging_insert_guard", 384 "radroots_runtime_legacy_event_staging_update_guard", 385 "radroots_runtime_legacy_import_commit_delete_guard", 386 "radroots_runtime_legacy_import_commit_update_guard", 387 "radroots_runtime_legacy_import_commits", 388 "radroots_runtime_legacy_import_delete_guard", 389 "radroots_runtime_legacy_import_identity_guard", 390 "radroots_runtime_legacy_import_member_delete_guard", 391 "radroots_runtime_legacy_import_member_identity_guard", 392 "radroots_runtime_legacy_import_member_state_guard", 393 "radroots_runtime_legacy_import_members", 394 "radroots_runtime_legacy_import_state_guard", 395 "radroots_runtime_legacy_import_state_idx", 396 "radroots_runtime_legacy_imports", 397 "radroots_runtime_legacy_outbox_staging", 398 "radroots_runtime_legacy_outbox_staging_delete_guard", 399 "radroots_runtime_legacy_outbox_staging_insert_guard", 400 "radroots_runtime_legacy_outbox_staging_parent_idx", 401 "radroots_runtime_legacy_outbox_staging_update_guard", 402 "radroots_runtime_outbox_items", 403 "radroots_runtime_outbox_operation_idx", 404 "radroots_runtime_outbox_ready_idx", 405 "radroots_runtime_outbox_targets", 406 "radroots_runtime_projection_checkpoints", 407 "radroots_runtime_projection_invalidations", 408 "radroots_runtime_projection_rebuilds", 409 "radroots_runtime_projection_rebuilds_stage_idx", 410 "radroots_runtime_source_generations", 411 "radroots_runtime_source_generations_active_idx", 412 "radroots_runtime_source_generations_delete_guard", 413 "radroots_runtime_source_generations_identity_guard", 414 "radroots_runtime_source_generations_sequence_guard", 415 ]; 416 417 const RUNTIME_V12_OBJECTS: &[&str] = &[ 418 "radroots_runtime_atomic_commits", 419 "radroots_runtime_authored_artifacts", 420 "radroots_runtime_authored_artifacts_admission_ready_idx", 421 "radroots_runtime_authored_artifacts_signing_ready_idx", 422 "radroots_runtime_authored_atomic_commits", 423 "radroots_runtime_authored_atomic_commits_delete_guard", 424 "radroots_runtime_authored_atomic_commits_update_guard", 425 "radroots_runtime_authored_delivery_attempts", 426 "radroots_runtime_authored_delivery_plans", 427 "radroots_runtime_authored_delivery_ready_idx", 428 "radroots_runtime_authored_delivery_targets", 429 "radroots_runtime_authored_migration_evidence", 430 "radroots_runtime_authored_migration_evidence_delete_guard", 431 "radroots_runtime_authored_migration_evidence_update_guard", 432 "radroots_runtime_authored_operations", 433 "radroots_runtime_delivery_evidence", 434 "radroots_runtime_delivery_evidence_item_idx", 435 "radroots_runtime_event_index_checkpoints", 436 "radroots_runtime_event_index_manifests", 437 "radroots_runtime_event_index_shards", 438 "radroots_runtime_event_provenance", 439 "radroots_runtime_event_provenance_observed_idx", 440 "radroots_runtime_events", 441 "radroots_runtime_events_admission_idx", 442 "radroots_runtime_events_contract_metadata_guard", 443 "radroots_runtime_events_contract_metadata_insert_guard", 444 "radroots_runtime_events_delete_guard", 445 "radroots_runtime_events_event_id_idx", 446 "radroots_runtime_events_raw_update_guard", 447 "radroots_runtime_journal_idempotency_idx", 448 "radroots_runtime_journal_operations", 449 "radroots_runtime_journal_recovery_idx", 450 "radroots_runtime_legacy_event_staging", 451 "radroots_runtime_legacy_event_staging_delete_guard", 452 "radroots_runtime_legacy_event_staging_insert_guard", 453 "radroots_runtime_legacy_event_staging_update_guard", 454 "radroots_runtime_legacy_import_commit_delete_guard", 455 "radroots_runtime_legacy_import_commit_update_guard", 456 "radroots_runtime_legacy_import_commits", 457 "radroots_runtime_legacy_import_delete_guard", 458 "radroots_runtime_legacy_import_identity_guard", 459 "radroots_runtime_legacy_import_member_delete_guard", 460 "radroots_runtime_legacy_import_member_identity_guard", 461 "radroots_runtime_legacy_import_member_state_guard", 462 "radroots_runtime_legacy_import_members", 463 "radroots_runtime_legacy_import_state_guard", 464 "radroots_runtime_legacy_import_state_idx", 465 "radroots_runtime_legacy_imports", 466 "radroots_runtime_legacy_outbox_staging", 467 "radroots_runtime_legacy_outbox_staging_delete_guard", 468 "radroots_runtime_legacy_outbox_staging_insert_guard", 469 "radroots_runtime_legacy_outbox_staging_parent_idx", 470 "radroots_runtime_legacy_outbox_staging_update_guard", 471 "radroots_runtime_outbox_items", 472 "radroots_runtime_outbox_operation_idx", 473 "radroots_runtime_outbox_ready_idx", 474 "radroots_runtime_outbox_targets", 475 "radroots_runtime_projection_checkpoints", 476 "radroots_runtime_projection_documents", 477 "radroots_runtime_projection_invalidations", 478 "radroots_runtime_projection_rebuilds", 479 "radroots_runtime_projection_rebuilds_stage_idx", 480 "radroots_runtime_projection_snapshots", 481 "radroots_runtime_projection_snapshots_created_idx", 482 "radroots_runtime_projection_snapshots_update_guard", 483 "radroots_runtime_source_generations", 484 "radroots_runtime_source_generations_active_idx", 485 "radroots_runtime_source_generations_delete_guard", 486 "radroots_runtime_source_generations_identity_guard", 487 "radroots_runtime_source_generations_sequence_guard", 488 ]; 489 490 const RUNTIME_V13_OBJECTS: &[&str] = &[ 491 "radroots_runtime_atomic_commits", 492 "radroots_runtime_authored_artifacts", 493 "radroots_runtime_authored_artifacts_admission_ready_idx", 494 "radroots_runtime_authored_artifacts_signing_ready_idx", 495 "radroots_runtime_authored_atomic_commits", 496 "radroots_runtime_authored_atomic_commits_delete_guard", 497 "radroots_runtime_authored_atomic_commits_update_guard", 498 "radroots_runtime_authored_delivery_attempts", 499 "radroots_runtime_authored_delivery_plans", 500 "radroots_runtime_authored_delivery_ready_idx", 501 "radroots_runtime_authored_delivery_targets", 502 "radroots_runtime_authored_draft_author_head_idx", 503 "radroots_runtime_authored_draft_revisions", 504 "radroots_runtime_authored_draft_revisions_delete_guard", 505 "radroots_runtime_authored_draft_revisions_update_guard", 506 "radroots_runtime_authored_migration_evidence", 507 "radroots_runtime_authored_migration_evidence_delete_guard", 508 "radroots_runtime_authored_migration_evidence_update_guard", 509 "radroots_runtime_authored_operations", 510 "radroots_runtime_delivery_evidence", 511 "radroots_runtime_delivery_evidence_item_idx", 512 "radroots_runtime_event_index_checkpoints", 513 "radroots_runtime_event_index_manifests", 514 "radroots_runtime_event_index_shards", 515 "radroots_runtime_event_provenance", 516 "radroots_runtime_event_provenance_observed_idx", 517 "radroots_runtime_events", 518 "radroots_runtime_events_admission_idx", 519 "radroots_runtime_events_contract_metadata_guard", 520 "radroots_runtime_events_contract_metadata_insert_guard", 521 "radroots_runtime_events_delete_guard", 522 "radroots_runtime_events_event_id_idx", 523 "radroots_runtime_events_raw_update_guard", 524 "radroots_runtime_journal_idempotency_idx", 525 "radroots_runtime_journal_operations", 526 "radroots_runtime_journal_recovery_idx", 527 "radroots_runtime_legacy_event_staging", 528 "radroots_runtime_legacy_event_staging_delete_guard", 529 "radroots_runtime_legacy_event_staging_insert_guard", 530 "radroots_runtime_legacy_event_staging_update_guard", 531 "radroots_runtime_legacy_import_commit_delete_guard", 532 "radroots_runtime_legacy_import_commit_update_guard", 533 "radroots_runtime_legacy_import_commits", 534 "radroots_runtime_legacy_import_delete_guard", 535 "radroots_runtime_legacy_import_identity_guard", 536 "radroots_runtime_legacy_import_member_delete_guard", 537 "radroots_runtime_legacy_import_member_identity_guard", 538 "radroots_runtime_legacy_import_member_state_guard", 539 "radroots_runtime_legacy_import_members", 540 "radroots_runtime_legacy_import_state_guard", 541 "radroots_runtime_legacy_import_state_idx", 542 "radroots_runtime_legacy_imports", 543 "radroots_runtime_legacy_outbox_staging", 544 "radroots_runtime_legacy_outbox_staging_delete_guard", 545 "radroots_runtime_legacy_outbox_staging_insert_guard", 546 "radroots_runtime_legacy_outbox_staging_parent_idx", 547 "radroots_runtime_legacy_outbox_staging_update_guard", 548 "radroots_runtime_outbox_items", 549 "radroots_runtime_outbox_operation_idx", 550 "radroots_runtime_outbox_ready_idx", 551 "radroots_runtime_outbox_targets", 552 "radroots_runtime_projection_checkpoints", 553 "radroots_runtime_projection_documents", 554 "radroots_runtime_projection_invalidations", 555 "radroots_runtime_projection_rebuilds", 556 "radroots_runtime_projection_rebuilds_stage_idx", 557 "radroots_runtime_projection_snapshots", 558 "radroots_runtime_projection_snapshots_created_idx", 559 "radroots_runtime_projection_snapshots_update_guard", 560 "radroots_runtime_source_generations", 561 "radroots_runtime_source_generations_active_idx", 562 "radroots_runtime_source_generations_delete_guard", 563 "radroots_runtime_source_generations_identity_guard", 564 "radroots_runtime_source_generations_sequence_guard", 565 ]; 566 567 const RUNTIME_V14_OBJECTS: &[&str] = &[ 568 "radroots_runtime_atomic_commits", 569 "radroots_runtime_authored_artifacts", 570 "radroots_runtime_authored_artifacts_admission_ready_idx", 571 "radroots_runtime_authored_artifacts_signing_ready_idx", 572 "radroots_runtime_authored_atomic_commits", 573 "radroots_runtime_authored_atomic_commits_delete_guard", 574 "radroots_runtime_authored_atomic_commits_update_guard", 575 "radroots_runtime_authored_delivery_attempts", 576 "radroots_runtime_authored_delivery_plans", 577 "radroots_runtime_authored_delivery_ready_idx", 578 "radroots_runtime_authored_delivery_targets", 579 "radroots_runtime_authored_draft_author_head_idx", 580 "radroots_runtime_authored_draft_revisions", 581 "radroots_runtime_authored_draft_revisions_delete_guard", 582 "radroots_runtime_authored_draft_revisions_update_guard", 583 "radroots_runtime_authored_draft_scope_head_idx", 584 "radroots_runtime_authored_migration_evidence", 585 "radroots_runtime_authored_migration_evidence_delete_guard", 586 "radroots_runtime_authored_migration_evidence_update_guard", 587 "radroots_runtime_authored_operations", 588 "radroots_runtime_delivery_evidence", 589 "radroots_runtime_delivery_evidence_item_idx", 590 "radroots_runtime_event_index_checkpoints", 591 "radroots_runtime_event_index_manifests", 592 "radroots_runtime_event_index_shards", 593 "radroots_runtime_event_provenance", 594 "radroots_runtime_event_provenance_observed_idx", 595 "radroots_runtime_events", 596 "radroots_runtime_events_admission_idx", 597 "radroots_runtime_events_contract_metadata_guard", 598 "radroots_runtime_events_contract_metadata_insert_guard", 599 "radroots_runtime_events_delete_guard", 600 "radroots_runtime_events_event_id_idx", 601 "radroots_runtime_events_raw_update_guard", 602 "radroots_runtime_journal_idempotency_idx", 603 "radroots_runtime_journal_operations", 604 "radroots_runtime_journal_recovery_idx", 605 "radroots_runtime_legacy_event_staging", 606 "radroots_runtime_legacy_event_staging_delete_guard", 607 "radroots_runtime_legacy_event_staging_insert_guard", 608 "radroots_runtime_legacy_event_staging_update_guard", 609 "radroots_runtime_legacy_import_commit_delete_guard", 610 "radroots_runtime_legacy_import_commit_update_guard", 611 "radroots_runtime_legacy_import_commits", 612 "radroots_runtime_legacy_import_delete_guard", 613 "radroots_runtime_legacy_import_identity_guard", 614 "radroots_runtime_legacy_import_member_delete_guard", 615 "radroots_runtime_legacy_import_member_identity_guard", 616 "radroots_runtime_legacy_import_member_state_guard", 617 "radroots_runtime_legacy_import_members", 618 "radroots_runtime_legacy_import_state_guard", 619 "radroots_runtime_legacy_import_state_idx", 620 "radroots_runtime_legacy_imports", 621 "radroots_runtime_legacy_outbox_staging", 622 "radroots_runtime_legacy_outbox_staging_delete_guard", 623 "radroots_runtime_legacy_outbox_staging_insert_guard", 624 "radroots_runtime_legacy_outbox_staging_parent_idx", 625 "radroots_runtime_legacy_outbox_staging_update_guard", 626 "radroots_runtime_outbox_items", 627 "radroots_runtime_outbox_operation_idx", 628 "radroots_runtime_outbox_ready_idx", 629 "radroots_runtime_outbox_targets", 630 "radroots_runtime_projection_checkpoints", 631 "radroots_runtime_projection_documents", 632 "radroots_runtime_projection_invalidations", 633 "radroots_runtime_projection_rebuilds", 634 "radroots_runtime_projection_rebuilds_stage_idx", 635 "radroots_runtime_projection_snapshots", 636 "radroots_runtime_projection_snapshots_created_idx", 637 "radroots_runtime_projection_snapshots_update_guard", 638 "radroots_runtime_source_generations", 639 "radroots_runtime_source_generations_active_idx", 640 "radroots_runtime_source_generations_delete_guard", 641 "radroots_runtime_source_generations_identity_guard", 642 "radroots_runtime_source_generations_sequence_guard", 643 ]; 644 645 const RUNTIME_V15_OBJECTS: &[&str] = &[ 646 "radroots_runtime_atomic_commits", 647 "radroots_runtime_authored_artifacts", 648 "radroots_runtime_authored_artifacts_admission_ready_idx", 649 "radroots_runtime_authored_artifacts_signed_fact_guard", 650 "radroots_runtime_authored_artifacts_signing_ready_idx", 651 "radroots_runtime_authored_atomic_commits", 652 "radroots_runtime_authored_atomic_commits_delete_guard", 653 "radroots_runtime_authored_atomic_commits_update_guard", 654 "radroots_runtime_authored_delivery_attempts", 655 "radroots_runtime_authored_delivery_plans", 656 "radroots_runtime_authored_delivery_ready_idx", 657 "radroots_runtime_authored_delivery_targets", 658 "radroots_runtime_authored_draft_author_head_idx", 659 "radroots_runtime_authored_draft_revisions", 660 "radroots_runtime_authored_draft_revisions_delete_guard", 661 "radroots_runtime_authored_draft_revisions_update_guard", 662 "radroots_runtime_authored_draft_scope_head_idx", 663 "radroots_runtime_authored_migration_evidence", 664 "radroots_runtime_authored_migration_evidence_delete_guard", 665 "radroots_runtime_authored_migration_evidence_update_guard", 666 "radroots_runtime_authored_operations", 667 "radroots_runtime_delivery_evidence", 668 "radroots_runtime_delivery_evidence_item_idx", 669 "radroots_runtime_event_index_checkpoints", 670 "radroots_runtime_event_index_manifests", 671 "radroots_runtime_event_index_shards", 672 "radroots_runtime_event_provenance", 673 "radroots_runtime_event_provenance_observed_idx", 674 "radroots_runtime_events", 675 "radroots_runtime_events_admission_idx", 676 "radroots_runtime_events_contract_metadata_guard", 677 "radroots_runtime_events_contract_metadata_insert_guard", 678 "radroots_runtime_events_delete_guard", 679 "radroots_runtime_events_event_id_idx", 680 "radroots_runtime_events_raw_update_guard", 681 "radroots_runtime_journal_idempotency_idx", 682 "radroots_runtime_journal_operations", 683 "radroots_runtime_journal_recovery_idx", 684 "radroots_runtime_legacy_event_staging", 685 "radroots_runtime_legacy_event_staging_delete_guard", 686 "radroots_runtime_legacy_event_staging_insert_guard", 687 "radroots_runtime_legacy_event_staging_update_guard", 688 "radroots_runtime_legacy_import_commit_delete_guard", 689 "radroots_runtime_legacy_import_commit_update_guard", 690 "radroots_runtime_legacy_import_commits", 691 "radroots_runtime_legacy_import_delete_guard", 692 "radroots_runtime_legacy_import_identity_guard", 693 "radroots_runtime_legacy_import_member_delete_guard", 694 "radroots_runtime_legacy_import_member_identity_guard", 695 "radroots_runtime_legacy_import_member_state_guard", 696 "radroots_runtime_legacy_import_members", 697 "radroots_runtime_legacy_import_state_guard", 698 "radroots_runtime_legacy_import_state_idx", 699 "radroots_runtime_legacy_imports", 700 "radroots_runtime_legacy_outbox_staging", 701 "radroots_runtime_legacy_outbox_staging_delete_guard", 702 "radroots_runtime_legacy_outbox_staging_insert_guard", 703 "radroots_runtime_legacy_outbox_staging_parent_idx", 704 "radroots_runtime_legacy_outbox_staging_update_guard", 705 "radroots_runtime_outbox_items", 706 "radroots_runtime_outbox_operation_idx", 707 "radroots_runtime_outbox_ready_idx", 708 "radroots_runtime_outbox_targets", 709 "radroots_runtime_projection_checkpoints", 710 "radroots_runtime_projection_documents", 711 "radroots_runtime_projection_invalidations", 712 "radroots_runtime_projection_rebuilds", 713 "radroots_runtime_projection_rebuilds_stage_idx", 714 "radroots_runtime_projection_snapshots", 715 "radroots_runtime_projection_snapshots_created_idx", 716 "radroots_runtime_projection_snapshots_update_guard", 717 "radroots_runtime_source_generations", 718 "radroots_runtime_source_generations_active_idx", 719 "radroots_runtime_source_generations_delete_guard", 720 "radroots_runtime_source_generations_identity_guard", 721 "radroots_runtime_source_generations_sequence_guard", 722 ]; 723 724 const RUNTIME_V16_OBJECTS: &[&str] = &[ 725 "radroots_runtime_atomic_commits", 726 "radroots_runtime_authored_artifacts", 727 "radroots_runtime_authored_artifacts_admission_ready_idx", 728 "radroots_runtime_authored_artifacts_signed_fact_guard", 729 "radroots_runtime_authored_artifacts_signing_ready_idx", 730 "radroots_runtime_authored_atomic_commits", 731 "radroots_runtime_authored_atomic_commits_delete_guard", 732 "radroots_runtime_authored_atomic_commits_update_guard", 733 "radroots_runtime_authored_delivery_attempts", 734 "radroots_runtime_authored_delivery_facts", 735 "radroots_runtime_authored_delivery_facts_delete_guard", 736 "radroots_runtime_authored_delivery_facts_update_guard", 737 "radroots_runtime_authored_delivery_plans", 738 "radroots_runtime_authored_delivery_ready_idx", 739 "radroots_runtime_authored_delivery_stop_guard", 740 "radroots_runtime_authored_delivery_targets", 741 "radroots_runtime_authored_draft_author_head_idx", 742 "radroots_runtime_authored_draft_revisions", 743 "radroots_runtime_authored_draft_revisions_delete_guard", 744 "radroots_runtime_authored_draft_revisions_update_guard", 745 "radroots_runtime_authored_draft_scope_head_idx", 746 "radroots_runtime_authored_migration_evidence", 747 "radroots_runtime_authored_migration_evidence_delete_guard", 748 "radroots_runtime_authored_migration_evidence_update_guard", 749 "radroots_runtime_authored_operations", 750 "radroots_runtime_delivery_evidence", 751 "radroots_runtime_delivery_evidence_item_idx", 752 "radroots_runtime_event_index_checkpoints", 753 "radroots_runtime_event_index_manifests", 754 "radroots_runtime_event_index_shards", 755 "radroots_runtime_event_provenance", 756 "radroots_runtime_event_provenance_observed_idx", 757 "radroots_runtime_events", 758 "radroots_runtime_events_admission_idx", 759 "radroots_runtime_events_contract_metadata_guard", 760 "radroots_runtime_events_contract_metadata_insert_guard", 761 "radroots_runtime_events_delete_guard", 762 "radroots_runtime_events_event_id_idx", 763 "radroots_runtime_events_raw_update_guard", 764 "radroots_runtime_journal_idempotency_idx", 765 "radroots_runtime_journal_operations", 766 "radroots_runtime_journal_recovery_idx", 767 "radroots_runtime_legacy_event_staging", 768 "radroots_runtime_legacy_event_staging_delete_guard", 769 "radroots_runtime_legacy_event_staging_insert_guard", 770 "radroots_runtime_legacy_event_staging_update_guard", 771 "radroots_runtime_legacy_import_commit_delete_guard", 772 "radroots_runtime_legacy_import_commit_update_guard", 773 "radroots_runtime_legacy_import_commits", 774 "radroots_runtime_legacy_import_delete_guard", 775 "radroots_runtime_legacy_import_identity_guard", 776 "radroots_runtime_legacy_import_member_delete_guard", 777 "radroots_runtime_legacy_import_member_identity_guard", 778 "radroots_runtime_legacy_import_member_state_guard", 779 "radroots_runtime_legacy_import_members", 780 "radroots_runtime_legacy_import_state_guard", 781 "radroots_runtime_legacy_import_state_idx", 782 "radroots_runtime_legacy_imports", 783 "radroots_runtime_legacy_outbox_staging", 784 "radroots_runtime_legacy_outbox_staging_delete_guard", 785 "radroots_runtime_legacy_outbox_staging_insert_guard", 786 "radroots_runtime_legacy_outbox_staging_parent_idx", 787 "radroots_runtime_legacy_outbox_staging_update_guard", 788 "radroots_runtime_outbox_items", 789 "radroots_runtime_outbox_operation_idx", 790 "radroots_runtime_outbox_ready_idx", 791 "radroots_runtime_outbox_targets", 792 "radroots_runtime_projection_checkpoints", 793 "radroots_runtime_projection_documents", 794 "radroots_runtime_projection_invalidations", 795 "radroots_runtime_projection_rebuilds", 796 "radroots_runtime_projection_rebuilds_stage_idx", 797 "radroots_runtime_projection_snapshots", 798 "radroots_runtime_projection_snapshots_created_idx", 799 "radroots_runtime_projection_snapshots_update_guard", 800 "radroots_runtime_source_generations", 801 "radroots_runtime_source_generations_active_idx", 802 "radroots_runtime_source_generations_delete_guard", 803 "radroots_runtime_source_generations_identity_guard", 804 "radroots_runtime_source_generations_sequence_guard", 805 ]; 806 807 const RUNTIME_V17_OBJECTS: &[&str] = &[ 808 "radroots_runtime_atomic_commits", 809 "radroots_runtime_authored_artifacts", 810 "radroots_runtime_authored_artifacts_admission_ready_idx", 811 "radroots_runtime_authored_artifacts_signed_fact_guard", 812 "radroots_runtime_authored_artifacts_signing_ready_idx", 813 "radroots_runtime_authored_atomic_commits", 814 "radroots_runtime_authored_atomic_commits_delete_guard", 815 "radroots_runtime_authored_atomic_commits_update_guard", 816 "radroots_runtime_authored_atomic_target_phase_idx", 817 "radroots_runtime_authored_delivery_attempts", 818 "radroots_runtime_authored_delivery_claims", 819 "radroots_runtime_authored_delivery_claims_delete_guard", 820 "radroots_runtime_authored_delivery_claims_update_guard", 821 "radroots_runtime_authored_delivery_facts", 822 "radroots_runtime_authored_delivery_facts_delete_guard", 823 "radroots_runtime_authored_delivery_facts_update_guard", 824 "radroots_runtime_authored_delivery_plans", 825 "radroots_runtime_authored_delivery_ready_idx", 826 "radroots_runtime_authored_delivery_reconciliations", 827 "radroots_runtime_authored_delivery_reconciliations_delete_guard", 828 "radroots_runtime_authored_delivery_reconciliations_update_guard", 829 "radroots_runtime_authored_delivery_stop_guard", 830 "radroots_runtime_authored_delivery_targets", 831 "radroots_runtime_authored_draft_author_head_idx", 832 "radroots_runtime_authored_draft_revisions", 833 "radroots_runtime_authored_draft_revisions_delete_guard", 834 "radroots_runtime_authored_draft_revisions_update_guard", 835 "radroots_runtime_authored_draft_scope_head_idx", 836 "radroots_runtime_authored_migration_evidence", 837 "radroots_runtime_authored_migration_evidence_delete_guard", 838 "radroots_runtime_authored_migration_evidence_update_guard", 839 "radroots_runtime_authored_operations", 840 "radroots_runtime_delivery_evidence", 841 "radroots_runtime_delivery_evidence_item_idx", 842 "radroots_runtime_event_index_checkpoints", 843 "radroots_runtime_event_index_manifests", 844 "radroots_runtime_event_index_shards", 845 "radroots_runtime_event_provenance", 846 "radroots_runtime_event_provenance_observed_idx", 847 "radroots_runtime_events", 848 "radroots_runtime_events_admission_idx", 849 "radroots_runtime_events_contract_metadata_guard", 850 "radroots_runtime_events_contract_metadata_insert_guard", 851 "radroots_runtime_events_delete_guard", 852 "radroots_runtime_events_event_id_idx", 853 "radroots_runtime_events_raw_update_guard", 854 "radroots_runtime_journal_idempotency_idx", 855 "radroots_runtime_journal_operations", 856 "radroots_runtime_journal_recovery_idx", 857 "radroots_runtime_legacy_event_staging", 858 "radroots_runtime_legacy_event_staging_delete_guard", 859 "radroots_runtime_legacy_event_staging_insert_guard", 860 "radroots_runtime_legacy_event_staging_update_guard", 861 "radroots_runtime_legacy_import_commit_delete_guard", 862 "radroots_runtime_legacy_import_commit_update_guard", 863 "radroots_runtime_legacy_import_commits", 864 "radroots_runtime_legacy_import_delete_guard", 865 "radroots_runtime_legacy_import_identity_guard", 866 "radroots_runtime_legacy_import_member_delete_guard", 867 "radroots_runtime_legacy_import_member_identity_guard", 868 "radroots_runtime_legacy_import_member_state_guard", 869 "radroots_runtime_legacy_import_members", 870 "radroots_runtime_legacy_import_state_guard", 871 "radroots_runtime_legacy_import_state_idx", 872 "radroots_runtime_legacy_imports", 873 "radroots_runtime_legacy_outbox_staging", 874 "radroots_runtime_legacy_outbox_staging_delete_guard", 875 "radroots_runtime_legacy_outbox_staging_insert_guard", 876 "radroots_runtime_legacy_outbox_staging_parent_idx", 877 "radroots_runtime_legacy_outbox_staging_update_guard", 878 "radroots_runtime_outbox_items", 879 "radroots_runtime_outbox_operation_idx", 880 "radroots_runtime_outbox_ready_idx", 881 "radroots_runtime_outbox_targets", 882 "radroots_runtime_projection_checkpoints", 883 "radroots_runtime_projection_documents", 884 "radroots_runtime_projection_invalidations", 885 "radroots_runtime_projection_rebuilds", 886 "radroots_runtime_projection_rebuilds_stage_idx", 887 "radroots_runtime_projection_snapshots", 888 "radroots_runtime_projection_snapshots_created_idx", 889 "radroots_runtime_projection_snapshots_update_guard", 890 "radroots_runtime_source_generations", 891 "radroots_runtime_source_generations_active_idx", 892 "radroots_runtime_source_generations_delete_guard", 893 "radroots_runtime_source_generations_identity_guard", 894 "radroots_runtime_source_generations_sequence_guard", 895 ]; 896 897 /// Ordered, immutable runtime migration plan. 898 pub const MIGRATIONS: &[MigrationDescriptor] = &[ 899 MigrationDescriptor { 900 version: 1, 901 name: "runtime_authority", 902 up_sha256: "3b869122dd5bd58f4a15e7a71fd1377879640b36cd496d7b3f15278ef1e128c9", 903 owned_objects: RUNTIME_V1_OBJECTS, 904 }, 905 MigrationDescriptor { 906 version: 2, 907 name: "canonical_event_storage", 908 up_sha256: "35b036ba84eff7135665c4ae42fa8232d8bacd8115805b03011a3eb76423f4b8", 909 owned_objects: RUNTIME_V2_OBJECTS, 910 }, 911 MigrationDescriptor { 912 version: 3, 913 name: "operation_journal", 914 up_sha256: "4caa69a316777cabfc647e6d022007c1433a5793b2a55679629e8fac4d50a0f0", 915 owned_objects: RUNTIME_V2_OBJECTS, 916 }, 917 MigrationDescriptor { 918 version: 4, 919 name: "outbox_delivery_evidence", 920 up_sha256: "435ad7590be7cd9d5b5ee3c9eb2d53419eba3ba12b0f0fc623f1787517524842", 921 owned_objects: RUNTIME_V4_OBJECTS, 922 }, 923 MigrationDescriptor { 924 version: 5, 925 name: "projection_metadata", 926 up_sha256: "ef162e3591057414b5704ff07fc93e57127ad7996ab3d431541418fd9c285e51", 927 owned_objects: RUNTIME_V4_OBJECTS, 928 }, 929 MigrationDescriptor { 930 version: 6, 931 name: "legacy_import_journal", 932 up_sha256: "5858336c25b048d6cdae1beedc8bf0bdfb530b858c3c50f501621c3314d23d4a", 933 owned_objects: RUNTIME_V6_OBJECTS, 934 }, 935 MigrationDescriptor { 936 version: 7, 937 name: "legacy_event_staging", 938 up_sha256: "cb10766ab1a98fa13e27f36fdab869c72efefda98ea2331da32e90b3528c63aa", 939 owned_objects: RUNTIME_V7_OBJECTS, 940 }, 941 MigrationDescriptor { 942 version: 8, 943 name: "legacy_outbox_staging", 944 up_sha256: "b2ad0ee5bf7ac9e56584623c641e5208f5446dd0ff5ced9f235cd1756781be34", 945 owned_objects: RUNTIME_V8_OBJECTS, 946 }, 947 MigrationDescriptor { 948 version: 9, 949 name: "legacy_import_commits", 950 up_sha256: "f0807eecd652a26844c3502d81386a9d54480cb178abe1b71035e0601916afb7", 951 owned_objects: RUNTIME_V9_OBJECTS, 952 }, 953 MigrationDescriptor { 954 version: 10, 955 name: "projection_rebuild_source_binding", 956 up_sha256: "8dfe0f83058f51e3edf9bdac16b408c6abdc88dd84a53f8e893aaf06fe89f7c7", 957 owned_objects: RUNTIME_V9_OBJECTS, 958 }, 959 MigrationDescriptor { 960 version: 11, 961 name: "authored_operations", 962 up_sha256: "f07fe6695e611caa1ff2de87ee9d20356960346298f3df4158d63021fe0f9327", 963 owned_objects: RUNTIME_V11_OBJECTS, 964 }, 965 MigrationDescriptor { 966 version: 12, 967 name: "materialized_projection_documents", 968 up_sha256: "c5a083ed078d2d1d9623b8c7fd6521055a59c6f4c099318779c9fa32fa17b211", 969 owned_objects: RUNTIME_V12_OBJECTS, 970 }, 971 MigrationDescriptor { 972 version: 13, 973 name: "authored_draft_revisions", 974 up_sha256: "7bb6466a14c7ca601b76852addf4a19996ee9ffd62436bdac8e9bf631dc46785", 975 owned_objects: RUNTIME_V13_OBJECTS, 976 }, 977 MigrationDescriptor { 978 version: 14, 979 name: "authored_draft_query_metadata", 980 up_sha256: "3e108ddf9fbbc559b5e36bbdcb1032343b771f91a074aebc62ae8ad6c1521b55", 981 owned_objects: RUNTIME_V14_OBJECTS, 982 }, 983 MigrationDescriptor { 984 version: 15, 985 name: "authored_signed_facts", 986 up_sha256: "d7ed7312b36f6ae633d2018d71d1bc0117097523ff46ecfaca8a99ca739aa026", 987 owned_objects: RUNTIME_V15_OBJECTS, 988 }, 989 MigrationDescriptor { 990 version: 16, 991 name: "authored_delivery_facts", 992 up_sha256: "f78d35fbe60255f152c4e7a8c23add6677ac3ae74eed7db1f3d8ef4ba0b8f3c3", 993 owned_objects: RUNTIME_V16_OBJECTS, 994 }, 995 MigrationDescriptor { 996 version: 17, 997 name: "authored_delivery_reconciliation", 998 up_sha256: "01463e7effeb368dd0577bfed79f566f7bb2af76d03e8e76898cc53332e2e573", 999 owned_objects: RUNTIME_V17_OBJECTS, 1000 }, 1001 ]; 1002 1003 pub(crate) const fn migration_sql(version: u32) -> Option<&'static str> { 1004 match version { 1005 1 => Some(RUNTIME_V1_SQL), 1006 2 => Some(CANONICAL_EVENT_STORAGE_V2_SQL), 1007 3 => Some(OPERATION_JOURNAL_V3_SQL), 1008 4 => Some(OUTBOX_DELIVERY_EVIDENCE_V4_SQL), 1009 5 => Some(PROJECTION_METADATA_V5_SQL), 1010 6 => Some(LEGACY_IMPORT_JOURNAL_V6_SQL), 1011 7 => Some(LEGACY_EVENT_STAGING_V7_SQL), 1012 8 => Some(LEGACY_OUTBOX_STAGING_V8_SQL), 1013 9 => Some(LEGACY_IMPORT_COMMITS_V9_SQL), 1014 10 => Some(PROJECTION_REBUILD_SOURCE_BINDING_V10_SQL), 1015 11 => Some(AUTHORED_OPERATIONS_V11_SQL), 1016 12 => Some(MATERIALIZED_PROJECTION_DOCUMENTS_V12_SQL), 1017 13 => Some(AUTHORED_DRAFT_REVISIONS_V13_SQL), 1018 14 => Some(AUTHORED_DRAFT_QUERY_V14_SQL), 1019 15 => Some(AUTHORED_SIGNED_FACTS_V15_SQL), 1020 16 => Some(AUTHORED_DELIVERY_FACTS_V16_SQL), 1021 17 => Some(AUTHORED_DELIVERY_RECONCILIATION_V17_SQL), 1022 _ => None, 1023 } 1024 } 1025 1026 #[cfg(test)] 1027 #[cfg_attr(coverage_nightly, coverage(off))] 1028 mod tests { 1029 use super::{CURRENT_VERSION, MIGRATIONS, MINIMUM_VERSION, migration_sql}; 1030 use serde::Deserialize; 1031 use sha2::{Digest, Sha256}; 1032 use sqlx::{Connection, Row, SqliteConnection}; 1033 1034 const PLAN_SNAPSHOT: &str = 1035 include_str!("../../../../../contracts/storage/runtime_schema_v1.toml"); 1036 1037 #[derive(Debug, Deserialize)] 1038 struct PlanSnapshot { 1039 schema_version: u32, 1040 database: String, 1041 application_id: u32, 1042 minimum_version: u32, 1043 current_version: u32, 1044 migration_name: String, 1045 migration_sha256: String, 1046 forward_only: bool, 1047 raw_sql_public: bool, 1048 authorities: Vec<String>, 1049 source_invariants: Vec<String>, 1050 migrations: Vec<MigrationSnapshot>, 1051 } 1052 1053 #[derive(Debug, Deserialize)] 1054 struct MigrationSnapshot { 1055 version: u32, 1056 name: String, 1057 sha256: String, 1058 owned_objects: Vec<String>, 1059 } 1060 1061 #[test] 1062 fn migration_plan_matches_governed_snapshot() { 1063 let snapshot = toml::from_str::<PlanSnapshot>(PLAN_SNAPSHOT).expect("valid snapshot"); 1064 assert_eq!(MINIMUM_VERSION, 1); 1065 assert_eq!(CURRENT_VERSION, 17); 1066 assert_eq!(MIGRATIONS.len(), 17); 1067 let migration = MIGRATIONS[8]; 1068 assert_eq!(snapshot.schema_version, 1); 1069 assert_eq!(snapshot.database, "runtime.sqlite"); 1070 assert_eq!(snapshot.application_id, 1_380_209_236); 1071 assert_eq!(snapshot.minimum_version, MINIMUM_VERSION); 1072 assert_eq!(snapshot.current_version, 9); 1073 assert_eq!(snapshot.migration_name, migration.name()); 1074 assert_eq!(snapshot.migration_sha256, migration.up_sha256()); 1075 assert!(snapshot.forward_only); 1076 assert!(!snapshot.raw_sql_public); 1077 assert_eq!(snapshot.authorities.len(), 12); 1078 assert_eq!(snapshot.source_invariants.len(), 5); 1079 assert_eq!(snapshot.migrations.len(), 9); 1080 for (expected, actual) in snapshot.migrations.iter().zip(&MIGRATIONS[..9]) { 1081 assert_eq!(expected.version, actual.version()); 1082 assert_eq!(expected.name, actual.name()); 1083 assert_eq!(expected.sha256, actual.up_sha256()); 1084 assert_eq!(expected.owned_objects, actual.owned_objects()); 1085 } 1086 } 1087 1088 #[test] 1089 fn embedded_migration_checksum_is_pinned() { 1090 for migration in MIGRATIONS { 1091 let sql = migration_sql(migration.version()).expect("registered SQL"); 1092 assert_eq!(format!("{:x}", Sha256::digest(sql)), migration.up_sha256()); 1093 } 1094 assert_eq!(migration_sql(CURRENT_VERSION + 1), None); 1095 } 1096 1097 #[tokio::test] 1098 async fn fresh_database_has_exact_owned_schema() { 1099 let mut connection = SqliteConnection::connect("sqlite::memory:") 1100 .await 1101 .expect("open memory SQLite"); 1102 for migration in MIGRATIONS { 1103 sqlx::raw_sql(migration_sql(migration.version()).expect("registered SQL")) 1104 .execute(&mut connection) 1105 .await 1106 .expect("apply runtime schema"); 1107 } 1108 1109 let rows = sqlx::query( 1110 "SELECT name FROM sqlite_schema \ 1111 WHERE name LIKE 'radroots_runtime_%' \ 1112 ORDER BY name", 1113 ) 1114 .fetch_all(&mut connection) 1115 .await 1116 .expect("inspect runtime schema"); 1117 let actual = rows 1118 .iter() 1119 .map(|row| row.get::<String, _>("name")) 1120 .collect::<Vec<_>>(); 1121 assert_eq!( 1122 actual, 1123 MIGRATIONS 1124 .last() 1125 .expect("current migration") 1126 .owned_objects() 1127 ); 1128 1129 let foreign_key_violations = sqlx::query("PRAGMA foreign_key_check") 1130 .fetch_all(&mut connection) 1131 .await 1132 .expect("inspect foreign keys"); 1133 assert!(foreign_key_violations.is_empty()); 1134 let integrity = sqlx::query_scalar::<_, String>("PRAGMA integrity_check") 1135 .fetch_one(&mut connection) 1136 .await 1137 .expect("inspect integrity"); 1138 assert_eq!(integrity, "ok"); 1139 } 1140 }