Check if dotnet-ef is installed - #294
Conversation
WalkthroughThe pull request introduces a new pre-migration check in the Changes
Sequence DiagramsequenceDiagram
participant App as Application
participant Tool as dotnet ef
App->>Tool: Check tool installation
alt Tool Not Installed
Tool-->>App: Non-zero exit code
App->>App: Throw Exception
else Tool Installed
App->>Tool: Execute Database Migration
end
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
Maple2.File.Ingest/Program.cs (1)
75-89: Extract common process execution logic.The process execution pattern is duplicated later in the code for running migrations. Consider extracting this into a helper method to improve maintainability and reduce code duplication.
Here's a suggested helper method:
private static void ExecuteCommand(string command, string errorMessage, TimeSpan? timeout = null) { using var process = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Process.Start(new ProcessStartInfo("CMD.exe", $"/C {command}") { RedirectStandardError = true }) : RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? Process.Start(new ProcessStartInfo("bash", $"-c {command}") { RedirectStandardError = true }) : throw new PlatformNotSupportedException("Unsupported OS platform"); if (process == null) { throw new InvalidOperationException($"Failed to start process to execute: {command}"); } if (!process.WaitForExit(timeout ?? TimeSpan.FromMinutes(1))) { throw new TimeoutException($"Command execution timed out: {command}"); } if (process.ExitCode != 0) { var error = process.StandardError.ReadToEnd(); throw new Exception($"{errorMessage}\nError: {error}"); } }Usage example:
// Check dotnet ef installation ExecuteCommand( "dotnet ef", "dotnet ef is not installed. Please install it by running 'dotnet tool install --global dotnet-ef'", TimeSpan.FromSeconds(10)); // Run migrations ExecuteCommand( $"cd {worldServerDir} && dotnet ef database update", "Failed to run database migrations");
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Maple2.File.Ingest/Program.cs(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
Summary by CodeRabbit