feat: PostgreSQLをprimary DBに移行する#64
Open
strnh wants to merge 7 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
quotebuilder の primary DB を SQLite から PostgreSQL 17 へ移行し、開発・CI・バックアップ/リストア周りを PostgreSQL 前提に揃えるPRです(receiptbuilder と同型の開発構成・ドライバを合わせる目的)。
Changes:
- 既定DB接続を
pgsqlに切り替え、開発用 PostgreSQL(Compose)と PHPUnit 用DB分離を追加 - PostgreSQL互換のため migration の HAVING 句を修正し、JSONリストア後に sequence を最大IDへ同期する処理を追加
- GitHub Actions で PostgreSQL 17 上の migration/Feature test を実行し、README に移行手順・制約を追記
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Feature/BackupTest.php | PostgreSQL の sequence 同期を検証するテストを追加 |
| app/Services/BackupRestorer.php | PostgreSQL の sequence を最大IDへ進める処理を追加 |
| database/migrations/2026_07_01_000000_create_customer_signatures_table.php | PostgreSQL非互換の HAVING 別名参照を修正 |
| compose.yaml | 開発用 PostgreSQL 17 サービスを追加(host port 55433) |
| docker/postgres/init/01-create-test-database.sql | PHPUnit 用 quotebuilder_test DB 作成を追加 |
| phpunit.xml | PHPUnit の既定DBを PostgreSQL(テストDB)へ変更 |
| scripts/init.sh | 初期化で PostgreSQL 起動・待機を行うよう変更 |
| scripts/init-test.sh | テスト用セットアップを PostgreSQL 前提へ変更 |
| .github/workflows/php-tests.yml | PostgreSQL 17 サービスで migration + Feature test を実行するCIを追加 |
| .github/workflows/ci.yml | フロントエンド(type-check/build)のCIを追加 |
| .env.example | 既定DB設定を PostgreSQL(compose 55433)に変更 |
| config/database.php | DB default を pgsql に変更 |
| config/queue.php | queue batching/failed の既定DBを pgsql に変更 |
| composer.json | SQLite DB ファイル作成の post-create 処理を削除 |
| README.md | PostgreSQL 前提の説明、SQLite→PostgreSQL移行手順・制約を追記 |
| resources/js/data/store.ts | コメント上の既定バックエンド表記を PostgreSQL に更新 |
| resources/js/data/adapters/api.ts | コメント上のバックエンド表記を PostgreSQL に更新 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
quotebuilderのprimary DBをSQLiteからPostgreSQL 17へ移行し、receiptbuilderとDBドライバ・開発構成を揃えます。
Closes #62
変更内容
.env.example/ database・queue設定の既定接続をpgsqlへ変更55433)HAVING別名参照を修正スコープ(実ファイル)
.env.example,config/database.php,config/queue.php,phpunit.xml,composer.jsoncompose.yaml,docker/postgres/init/01-create-test-database.sql,scripts/init.sh,scripts/init-test.shdatabase/migrations/2026_07_01_000000_create_customer_signatures_table.php,app/Services/BackupRestorer.php.github/workflows/php-tests.yml,.github/workflows/ci.yml,tests/TestCase.php,tests/Feature/BackupStorageTest.php,tests/Feature/BackupTest.phpREADME.md,resources/js/data/adapters/api.ts,resources/js/data/store.tsスコープ外
PostgreSQL向け障害復旧用フルバックアップ・リストアは独立機能として #63 に切り出しました。現PRではJSON export/importを移行経路とし、SQLiteフルバックアップはlegacy互換として維持します。
PHP 8.5要件の宣言と
composer.json制約の整合は #53 の別スコープです。現在のlockfileはSymfony 8.1(PHP 8.4.1以上)を含むため、本PRのCIは想定実行環境のPHP 8.5を使用します。検証
force=trueでテストDBへ固定する前に、SQLite互換で全202 tests / 744 assertions成功BackupStorageTest13 tests / 58 assertions成功vendor/bin/pint --test(変更PHPファイル)npm run type-checknpm run buildbash -n scripts/init.sh scripts/init-test.shFrontend checks: 成功PHP tests: PostgreSQL 17でmigrate:freshと全Feature test成功(最終pushでも再実行)