(&self)
| 139 | |
| 140 | impl Command for UpgradeSchema { |
| 141 | fn run(&self) -> CliResult<()> { |
| 142 | let path = std::env::current_dir()?; |
| 143 | let report = atomic_repository::Repository::upgrade_repository_schema(&path, self.dry_run)?; |
| 144 | print_info(&format!( |
| 145 | "Repository schema {}; this build supports through {} ({}).", |
| 146 | report.schema_version, report.supported_schema_version, report.build_version |
| 147 | )); |
| 148 | print_info(&format!( |
| 149 | "Created with: {}; migrated with: {}.", |
| 150 | report.created_with.as_deref().unwrap_or("unknown"), |
| 151 | report.migrated_with.as_deref().unwrap_or("unknown") |
| 152 | )); |
| 153 | for warning in &report.warnings { |
| 154 | print_warning(warning); |
| 155 | } |
| 156 | if !report.tables_to_add.is_empty() { |
| 157 | print_info(&format!( |
| 158 | "Tables to add: {}", |
| 159 | report.tables_to_add.join(", ") |
| 160 | )); |
| 161 | } |
| 162 | if !report.deferred_tables.is_empty() { |
| 163 | print_info(&format!( |
| 164 | "Absent domain-owned tables (not initialized; may be lazy or require their owner's migration): {}", |
| 165 | report.deferred_tables.join(", ") |
| 166 | )); |
| 167 | } |
| 168 | for blocker in &report.blockers { |
| 169 | print_warning(blocker); |
| 170 | } |
| 171 | if !report.blockers.is_empty() { |
| 172 | return Err(CliError::Internal(anyhow::anyhow!( |
| 173 | "schema upgrade blocked; no upgrade was applied" |
| 174 | ))); |
| 175 | } |
| 176 | if self.dry_run { |
| 177 | print_info("Dry run: nothing was written. Run atomic doctor upgrade-schema to apply compatible additions."); |
| 178 | } else if report.tables_added.is_empty() { |
| 179 | print_success("Compatible additive storage is already current; nothing was written."); |
| 180 | } else { |
| 181 | print_success(&format!("Added tables: {}", report.tables_added.join(", "))); |
| 182 | print_hint("Schema/capability fences and existing rows were preserved. This does not certify graph or index integrity; use atomic doctor check for verification."); |
| 183 | } |
| 184 | Ok(()) |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | /// Journaled working-copy registration reconciliation. |
nothing calls this directly
no test coverage detected