Skip to content

T54 crest new db service - #72

Merged
niden merged 4 commits into
masterfrom
T54-crest-new-db-service
Oct 20, 2026
Merged

niden merged 4 commits into
masterfrom
T54-crest-new-db-service

Conversation

@niden

@niden niden commented Oct 20, 2026

Copy link
Copy Markdown
Member

Hello!

In raising this pull request, I confirm the following:

  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR
  • composer test, composer cs and composer analyze all pass
  • I have created a PR for the documentation about this change, if user facing

  • Added new --database=none|mariadb|mysql|pgsql|sqlite and its question: a server database gets the service database in docker-compose.yml (mysql:8.4, mariadb:11.4 or postgres:18, with a health check and a named volume), the PDO extension in the Dockerfile, and the connection values in .env; sqlite gets the file storage/database.sqlite. Each flavor gets a DbProvider that registers the db service, so make:model reads the database with no manual step. The service reads each value from getenv(), then $_ENV, then a default for PHP on the host. Added Crest\Generator\Project\DatabaseChoice, the project stubs project-provider-db and project-provider-db-sqlite (ADR and MVC), and the shared project stubs project-compose-mysql, project-compose-mariadb, project-compose-pgsql, project-env-database and project-env-sqlite.
  • Added phalcon/phql to the composer.json of an MVC project with Phalcon v6 and a database.
  • Added the models key to the crest.php that new and init write for an MVC project. new --camel-case gives 'camelCase' => true, and new asks for it for an MVC project with a database; init writes false.
  • Changed the project stubs project-compose, project-dockerfile, project-env, project-gitignore, project-composer, project-config and project-front (ADR and MVC): they have new placeholders. When the project needs one, new stops before it writes a file if a published copy does not have it: publish the stub again. Without a database and without --camel-case, an old copy works as before.
  • Changed new: in a terminal, it asks for the database, so a script that sends answers to new needs one more line. Crest\Generator\Project\Answers has a new last argument database, and Crest\Project\Settings a new last argument camelCase.

Thanks

niden added 4 commits October 20, 2026 13:41
Assisted-by: Claude Code
Assisted-by: Claude Code
Assisted-by: Claude Code
Assisted-by: Claude Code
@niden
niden requested a review from Jeckerson October 20, 2026 18:44
@niden niden self-assigned this Oct 20, 2026
@niden niden added the enhancement New feature or request label Oct 20, 2026
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

Code Metrics Report

master (07e236b) #72 (b03ed8c) +/-
Coverage 99.7% 99.7% +0.0%
Test Execution Time 9s 12s +3s
Details
  |                     | master (07e236b) | #72 (b03ed8c) |  +/-  |
  |---------------------|------------------|---------------|-------|
+ | Coverage            |            99.7% |         99.7% | +0.0% |
  |   Files             |               85 |            86 |    +1 |
  |   Lines             |             2861 |          3046 |  +185 |
+ |   Covered           |             2854 |          3039 |  +185 |
- | Test Execution Time |               9s |           12s |   +3s |

Code coverage of files in pull request scope (100.0% → 100.0%, patch 100.0%)

Files Coverage +/- Patch Coverage Status
src/Command/InitCommand.php 100.0% 0.0% 100.0% modified
src/Command/NewCommand.php 100.0% 0.0% 100.0% modified
src/Generator/Project/AdrSkeleton.php 100.0% 0.0% 100.0% modified
src/Generator/Project/Answers.php 100.0% 0.0% - modified
src/Generator/Project/DatabaseChoice.php 100.0% +100.0% 100.0% added
src/Generator/Project/MvcSkeleton.php 100.0% 0.0% 100.0% modified
src/Project/Settings.php 100.0% 0.0% 100.0% modified

Reported by octocov

@niden
niden merged commit 5e79300 into master Oct 20, 2026
40 checks passed
@niden
niden deleted the T54-crest-new-db-service branch October 20, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant