Skip to content

Conversation

@exKAZUu
Copy link
Member

@exKAZUu exKAZUu commented Dec 13, 2025

Close #

Self Check

  • I've confirmed All checks have passed on this page.
    • PR title follows Angular's commit message format.
    • PR title doesn't have WIP:.
    • The test command (e.g., yarn test) passed.
    • The lint command (e.g., yarn lint) passed.
    • You may leave this box unchecked due to long workflows.
  • I've reviewed my changes on the GitHub diff view.
  • I've written the steps to test my changes.
  • I've added screenshots (if the UI changed).
    • You may leave this box unchecked if you didn't modify the UI.

Copilot AI review requested due to automatic review settings December 13, 2025 04:58
@gemini-code-assist
Copy link

Summary of Changes

Hello @exKAZUu, 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 refactors the management of SQLite PRAGMA settings by deprecating a specific Prisma command previously used for Litestream setup. It introduces new, dedicated utility functions that provide the necessary PRAGMA strings, enabling a more flexible and standardized way to apply these database configurations throughout the application.

Highlights

  • Command Removal: The prisma setup-db-for-litestream command has been entirely removed from the wb package, including its command definition and underlying script logic.
  • New SQLite Pragma Utilities: Two new utility functions, getConnectionLevelSqlitePragmas and getPersistentSqlitePragmas, have been introduced in packages/shared-lib/src/sqlite.ts to provide standardized SQLite PRAGMA strings.
  • Refactored Pragma Application: The previous method of applying SQLite pragmas via a direct Prisma raw query in a dedicated script has been replaced by these new, reusable utility functions, promoting a more modular approach to database configuration.
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.

Copy link

@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

このプルリクエストは、prisma setup-db-for-litestream コマンドを削除し、代わりにLitestreamに必要なSQLiteのPRAGMA文字列を返すヘルパーを shared-lib に追加するものです。これにより、PRAGMAの設定が wb コマンドからアプリケーションコード側に移譲され、より明示的な設定が可能になります。全体として、アーキテクチャの改善につながる良い変更だと評価します。新しく追加されたヘルパーについて、より良い実装方法を提案するコメントをいくつか追加しました。

export { parseCommandLineArgs } from './parseCommandLineArgs.js';
export { shuffle } from './shuffle.js';
export { sleep } from './sleep.js';
export { getConnectionLevelSqlitePragmas, getPersistentSqlitePragmas } from './sqlite.js';

Choose a reason for hiding this comment

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

medium

sqlite.ts での提案に合わせて、こちらも定数を export するように変更してください。

Suggested change
export { getConnectionLevelSqlitePragmas, getPersistentSqlitePragmas } from './sqlite.js';
export { CONNECTION_LEVEL_SQLITE_PRAGMAS, PERSISTENT_SQLITE_PRAGMAS } from './sqlite.js';

Comment on lines +1 to +7
export function getConnectionLevelSqlitePragmas(): string {
return 'PRAGMA busy_timeout = 5000; PRAGMA synchronous = NORMAL; PRAGMA wal_autocheckpoint = 0;';
}

export function getPersistentSqlitePragmas(): string {
return 'PRAGMA journal_mode = WAL;';
}

Choose a reason for hiding this comment

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

medium

これらの関数は常に固定の文字列を返すため、関数ではなく export した定数として定義する方がシンプルで分かりやすいです。これにより、不要な関数呼び出しのオーバーヘッドをなくし、値が定数であることを明確に示すことができます。

Suggested change
export function getConnectionLevelSqlitePragmas(): string {
return 'PRAGMA busy_timeout = 5000; PRAGMA synchronous = NORMAL; PRAGMA wal_autocheckpoint = 0;';
}
export function getPersistentSqlitePragmas(): string {
return 'PRAGMA journal_mode = WAL;';
}
export const CONNECTION_LEVEL_SQLITE_PRAGMAS = 'PRAGMA busy_timeout = 5000; PRAGMA synchronous = NORMAL; PRAGMA wal_autocheckpoint = 0;';
export const PERSISTENT_SQLITE_PRAGMAS = 'PRAGMA journal_mode = WAL;';

Copy link

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 refactors SQLite pragma configuration for Litestream by removing the CLI command prisma setup-db-for-litestream and replacing it with reusable utility functions. The change moves the pragma logic from a CLI-specific implementation to shared library functions that can be imported and used programmatically across the codebase.

Key Changes:

  • Removed the setUpDBForLitestream method and associated CLI command from the wb package
  • Added two new pragma getter functions in shared-lib: getConnectionLevelSqlitePragmas() and getPersistentSqlitePragmas()
  • Exported the new functions from shared-lib's public API

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/wb/src/scripts/prismaScripts.ts Removed setUpDBForLitestream method and unused runtimeWithArgs import
packages/wb/src/commands/prisma.ts Removed setUpDBForLitestreamCommand CLI command definition
packages/shared-lib/src/sqlite.ts Added new pragma getter functions for connection-level and persistent SQLite pragmas
packages/shared-lib/src/index.ts Exported the new pragma getter functions from shared-lib's public API

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +7
export function getConnectionLevelSqlitePragmas(): string {
return 'PRAGMA busy_timeout = 5000; PRAGMA synchronous = NORMAL; PRAGMA wal_autocheckpoint = 0;';
}

export function getPersistentSqlitePragmas(): string {
return 'PRAGMA journal_mode = WAL;';
}
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

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

The new pragma getter functions lack documentation explaining their purpose and usage. Consider adding JSDoc comments to describe:

  1. What these SQLite pragmas do
  2. Why they are separated into connection-level vs persistent pragmas
  3. The context that they are intended for use with Litestream (as referenced in the original code comment: https://litestream.io/tips/)
  4. When each function should be called

This documentation would help developers understand when and how to use these functions correctly.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +7
export function getConnectionLevelSqlitePragmas(): string {
return 'PRAGMA busy_timeout = 5000; PRAGMA synchronous = NORMAL; PRAGMA wal_autocheckpoint = 0;';
}

export function getPersistentSqlitePragmas(): string {
return 'PRAGMA journal_mode = WAL;';
}
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

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

The new pragma getter functions lack test coverage. Since shared-lib has tests for other utility functions (humanize, parseCommandLineArgs, zenkaku), these new functions should also have corresponding tests to verify:

  1. The returned pragma strings are formatted correctly
  2. The expected pragma statements are included in each function
  3. The pragmas remain consistent with Litestream best practices

Consider adding a test file at test/sqlite.test.ts.

Copilot uses AI. Check for mistakes.
@exKAZUu exKAZUu merged commit de0aaa4 into main Dec 13, 2025
14 checks passed
@exKAZUu exKAZUu deleted the prisma2 branch December 13, 2025 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants