Skip to content

Comments

feat: optimize database install#1235

Merged
hwbrzzl merged 5 commits intomasterfrom
bowen/optimize-database-install
Oct 19, 2025
Merged

feat: optimize database install#1235
hwbrzzl merged 5 commits intomasterfrom
bowen/optimize-database-install

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Oct 19, 2025

📑 Description

  1. The config/database.go file is used by the DB module and the Redis module simultaneously. config/database.go needs to be judged if it exists when installing github.com/goravel/redis. Hence, the database installation process needs to judge if config/database.go exists, if not, create it, then add the required configurations.
  2. In the Redis repo, we need to judge if config/database.go exists, if not, create it, then add the required configurations.

✅ Checks

  • Added test cases for my code

@codecov
Copy link

codecov bot commented Oct 19, 2025

Codecov Report

❌ Patch coverage is 70.17544% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.19%. Comparing base (e4741a0) to head (e667a79).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
support/stubs/stub.go 0.00% 14 Missing ⚠️
schedule/setup/setup.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1235      +/-   ##
==========================================
- Coverage   66.39%   66.19%   -0.20%     
==========================================
  Files         245      245              
  Lines       16954    16988      +34     
==========================================
- Hits        11257    11246      -11     
- Misses       5317     5363      +46     
+ Partials      380      379       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: eb54706 Previous: e4741a0 Ratio
Benchmark_Fatal 4e-7 ns/op 0 B/op 0 allocs/op 2e-7 ns/op 0 B/op 0 allocs/op 2
Benchmark_Fatal - ns/op 4e-7 ns/op 2e-7 ns/op 2

This comment was automatically generated by workflow using github-action-benchmark.

@hwbrzzl hwbrzzl marked this pull request as ready for review October 19, 2025 04:06
@hwbrzzl hwbrzzl requested a review from a team as a code owner October 19, 2025 04:06
Copilot AI review requested due to automatic review settings October 19, 2025 04:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes the database installation workflow by conditionally creating config/database.go, incrementally adding missing database configuration keys with annotations, and refactoring conditional modification logic to a unified options-based When API. Key changes include introducing file-existence condition helpers (WhenFileExists/WhenFileNotExists), extending AddConfig to support annotations, and splitting database config generation into a base stub plus incremental key insertion.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
support/stubs/stub.go Renames package to stubs and adds DatabaseConfig stub for initial database config file creation.
support/file/file.go Adds deprecated Contain wrapper and introduces new Contains helper for file content checks.
schedule/setup/setup.go Updates imports and replaces manual file-existence checks with WhenFileNotExists helper.
packages/modify/modify_test.go Adapts tests to new When signature; adds tests for file existence conditional helpers.
packages/modify/modify.go Refactors conditional modifiers into a generic When with option map; adds file existence and facade absence helpers.
packages/modify/actions_test.go Extends test to validate AddConfig annotation support.
packages/modify/actions.go Adds annotations support to AddConfig with comment injection logic.
database/setup/stubs.go Replaces full file stub with structured slice of Config entries plus annotations (module param now unused).
database/setup/setup.go Implements conditional creation of config file and incremental addition of missing database config keys.
console/console/stubs.go Updates import to renamed stubs package.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

hwbrzzl and others added 2 commits October 19, 2025 12:19
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@hwbrzzl hwbrzzl merged commit d55cef6 into master Oct 19, 2025
13 of 14 checks passed
@hwbrzzl hwbrzzl deleted the bowen/optimize-database-install branch October 19, 2025 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant