-
-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
♻️ refactor: refactor db core #7245
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
👍 @arvinxx Thank you for raising your pull request and contributing to our Community |
There was a problem hiding this 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 refactors the database core by updating import paths and centralizing database instance retrieval. Key changes include:
- Updating test files to use the new getTestDBInstance location within '@/database/core/dbForTest'.
- Refactoring the server database export to come from a new core module (db-adaptor).
- Adjusting relative import paths in core and test files for consistency.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/database/server/models/tests/user.test.ts | Updated import path for getTestDBInstance. |
src/database/server/models/tests/nextauth.test.ts | Updated import path for getTestDBInstance. |
src/database/server/index.ts | Refactored serverDB export to use the new db-adaptor module. |
src/database/repositories/dataImporter/deprecated/tests/index.test.ts | Updated import path for getTestDBInstance. |
src/database/models/tests/session.test.ts | Updated import path for getTestDBInstance. |
src/database/models/tests/_util.ts | Updated import path for getTestDBInstance; changed const export. |
src/database/models/tests/_test_template.ts | Switched to use getTestDB from the local _util module. |
src/database/core/web-server.ts | Adjusted DB instance type and import paths; removed unused export. |
src/database/core/dbForTest.ts | Adjusted relative path for schemas import. |
src/database/core/db-adaptor.ts | Introduced new db-adaptor module to export the serverDB instance. |
scripts/migrateServerDB/index.ts | Updated serverDB import path to match the new structure. |
Comments suppressed due to low confidence (1)
src/database/core/db-adaptor.ts:1
- [nitpick] The file name 'db-adaptor.ts' uses an unconventional spelling. Consider renaming it to 'db-adapter.ts' for clarity and to align with common conventions.
// import { isDesktop } from '@/const/version';
TestGru AssignmentSummary
Tip You can |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7245 +/- ##
=======================================
Coverage 89.86% 89.86%
=======================================
Files 749 750 +1
Lines 53896 53897 +1
Branches 5134 5134
=======================================
+ Hits 48433 48434 +1
Misses 5463 5463
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
❤️ Great PR @arvinxx ❤️ The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world. |
### [Version 1.77.4](v1.77.3...v1.77.4) <sup>Released on **2025-03-31**</sup> #### ♻ Code Refactoring - **misc**: Refactor db core. #### 💄 Styles - **misc**: Update branding. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### Code refactoring * **misc**: Refactor db core, closes [#7245](#7245) ([5c71db6](5c71db6)) #### Styles * **misc**: Update branding, closes [#7224](#7224) ([481cab0](481cab0)) </details> <div align="right"> [](#readme-top) </div>
🎉 This PR is included in version 1.77.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
### [Version 1.117.2](v1.117.1...v1.117.2) <sup>Released on **2025-04-01**</sup> #### ♻ Code Refactoring - **misc**: Refactor db core. #### 💄 Styles - **misc**: Update branding. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### Code refactoring * **misc**: Refactor db core, closes [lobehub#7245](https://github.com/bentwnghk/lobe-chat/issues/7245) ([5c71db6](5c71db6)) #### Styles * **misc**: Update branding, closes [lobehub#7224](https://github.com/bentwnghk/lobe-chat/issues/7224) ([481cab0](481cab0)) </details> <div align="right"> [](#readme-top) </div>
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
📝 补充信息 | Additional Information