Skip to content

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Dec 21, 2025

  • Add sqlite3 dependency for SQLite database driver
  • Create sql/ddl_sqlite.sql with complete schema (24 tables)
  • Add prepare-database-sqlite.sh script for database initialization
  • Update config/database.ts with SQLite storage path configuration
  • Update config/config.default.ts with SQLite-specific ORM options
  • Update config/config.unittest.ts to handle SQLite file paths
  • Update test/TestUtil.ts with SQLite connection and query support
  • Add npm scripts: dev:sqlite, test:sqlite, cov:sqlite, ci:sqlite
  • Update .env.example and CLAUDE.md documentation

SQLite eliminates the need for Docker containers during local development, reducing setup friction significantly. Usage:
npm run dev:sqlite # Start dev server with SQLite
npm run test:sqlite # Run tests with SQLite

🤖 Generated with Claude Code

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 21, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sqlite

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fengmk2, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates SQLite database support into the project, significantly enhancing the local development experience by removing the need for Docker containers. It involves adding new database schema, initialization scripts, and updating core configuration and testing utilities to ensure seamless operation with SQLite, alongside existing MySQL and PostgreSQL support. The changes aim to reduce setup friction and provide a faster, more lightweight development environment.

Highlights

  • SQLite Database Support: Introduced comprehensive support for SQLite as a database option, primarily targeting local development to streamline setup.
  • New Dependency and Schema: Added the sqlite3 npm dependency and a new sql/ddl_sqlite.sql file containing the complete database schema tailored for SQLite.
  • Database Initialization Script: Created prepare-database-sqlite.sh to automate the setup and initialization of the SQLite database.
  • Configuration Updates: Modified config/database.ts, config/config.default.ts, and config/config.unittest.ts to correctly configure SQLite storage paths, ORM options (like connection limits and busy timeouts), and test environments.
  • Test Utility Enhancements: Updated test/TestUtil.ts to include SQLite-specific connection handling, query execution logic (differentiating SELECT from other statements), and proper database truncation for SQLite.
  • New npm Scripts: Added dedicated npm scripts (dev:sqlite, test:sqlite, cov:sqlite, ci:sqlite) to easily run development, testing, coverage, and CI tasks using SQLite.
  • Documentation Updates: Updated .env.example and CLAUDE.md to reflect the new SQLite configuration options, development commands, and database model modification guidelines.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@socket-security
Copy link

socket-security bot commented Dec 21, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedsqlite3@​5.1.710010010086100

View full report

@codecov
Copy link

codecov bot commented Dec 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.29%. Comparing base (e6f9208) to head (e415f28).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #942      +/-   ##
==========================================
- Coverage   95.39%   95.29%   -0.11%     
==========================================
  Files         197      197              
  Lines       22262    22282      +20     
  Branches     2472     2075     -397     
==========================================
- Hits        21237    21233       -4     
- Misses       1025     1049      +24     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces SQLite support, which is a valuable addition for simplifying the local development setup. The implementation is thorough, covering configuration, database schema, test utilities, and documentation. The handling of SQLite-specific characteristics, such as connection limits and busy timeouts, is well-executed. I have identified a few areas for improvement to enhance robustness and usability. My feedback includes suggestions for making the database preparation script more reliable in CI and more intuitive for developers, as well as a fix in the test utilities to ensure compatibility with all supported database clients.

if (config.type === DATABASE_TYPE.SQLite) {
this.connection.close();
} else {
this.connection.destroy();
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The destroy() method is specific to the mysql2 client and is not available on the pg client, which could lead to errors when running tests with PostgreSQL. A more portable method is end(), which is supported by both mysql2 and pg clients for gracefully closing the connection. Using end() would make this utility more robust across different database types.

Suggested change
this.connection.destroy();
this.connection.end();
Comment on lines +6 to +8
DATA_DIR=${CNPMCORE_DATA_DIR:-.cnpmcore_unittest}
DB_NAME=${CNPMCORE_DATABASE_NAME:-cnpmcore_unittest}
DB_PATH=${CNPMCORE_SQLITE_PATH:-"${DATA_DIR}/${DB_NAME}.sqlite"}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The current default values for DATA_DIR and DB_NAME are hardcoded for the test environment. This means a developer running bash ./prepare-database-sqlite.sh for local development (as instructed in CLAUDE.md) will incorrectly set up the test database instead of the development one. This increases setup friction.

To improve this, the script could determine the correct defaults based on the execution context. For example, you could check npm_lifecycle_event to see if it's being run as part of a test script. This would make the script 'do the right thing' for both development and testing without requiring developers to set environment variables manually.

@fengmk2 fengmk2 force-pushed the sqlite branch 2 times, most recently from 5d8c9db to 8c5a08e Compare December 21, 2025 15:07
@fengmk2 fengmk2 linked an issue Dec 21, 2025 that may be closed by this pull request
- Add sqlite3 dependency for SQLite database driver
- Create sql/ddl_sqlite.sql with complete schema (24 tables)
- Add prepare-database-sqlite.sh script for database initialization
- Update config/database.ts with SQLite storage path configuration
- Update config/config.default.ts with SQLite-specific ORM options
- Update config/config.unittest.ts to handle SQLite file paths
- Update test/TestUtil.ts with SQLite connection and query support
- Add npm scripts: dev:sqlite, test:sqlite, cov:sqlite, ci:sqlite
- Update .env.example and CLAUDE.md documentation

SQLite eliminates the need for Docker containers during local development,
reducing setup friction significantly. Usage:
  npm run dev:sqlite     # Start dev server with SQLite
  npm run test:sqlite    # Run tests with SQLite

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@fengmk2 fengmk2 added bug Something isn't working and removed bug Something isn't working labels Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants