Skip to content

T95 make database sqlite - #98

Merged
niden merged 3 commits into
masterfrom
T95-make-database-sqlite
Nov 27, 2026
Merged

niden merged 3 commits into
masterfrom
T95-make-database-sqlite

Conversation

@niden

@niden niden commented Nov 22, 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 make:database <driver>: it adds a database to a project that exists, in each flavor, as crest new --database does for a new project. It reads crest.php. crest init --database (and its question, the last one) writes crest.php, then does the same. The shared work is in Crest\Generator\Project\DatabaseSetup.

Crest changes no file that exists. It writes DbProvider in the provider path from the stubs of new (MVC: a Phalcon\Db adapter; ADR: a DataMapper Connection with the alias db), and for SQLite storage/database.sqlite and storage/.gitkeep. A database file that exists stays, also with --force. Then it prints the line that registers DbProvider in the front controller, and the lines for .gitignore and .env.

DbProvider.php that exists stops the command before it writes a file; --force writes it again. init makes this check before it writes crest.php. The registerProviders() check of make:provider (#81) moved to Bootstrap::overriding(), so that the ADR guidance of both commands prints only the line to add when the front has the override.

The database suite (SQLite) runs the printed line: a project from crest new with no database, in each flavor, and a project with no crest.php through init --database, gets a db service that opens its SQLite file. The compose service, the Dockerfile lines and the cases of a server database are in #96; the checks of a project that exists are in #97.

Thanks

@niden niden self-assigned this Nov 22, 2026
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

Code Metrics Report

master (fe20ff2) T95-make-database-sqlite (0e6d02f) +/-
Coverage 99.8% 99.8% +0.0%
Test Execution Time 9s 13s +4s
Details
  |                     | master (fe20ff2) |    T95-make-database-sqlite    |  +/-  |
  |                     |                  |           (0e6d02f)            |       |
  |---------------------|------------------|--------------------------------|-------|
+ | Coverage            |            99.8% |                          99.8% | +0.0% |
  |   Files             |               95 |                             97 |    +2 |
  |   Lines             |             3894 |                           3965 |   +71 |
+ |   Covered           |             3887 |                           3958 |   +71 |
- | Test Execution Time |               9s |                            13s |   +4s |

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/Make/DatabaseCommand.php 100.0% +100.0% 100.0% added
src/Command/Make/ProviderCommand.php 100.0% 0.0% 100.0% modified
src/Command/NewCommand.php 100.0% 0.0% 100.0% modified
src/Commands.php 100.0% 0.0% 100.0% modified
src/Generator/Project/AdrSkeleton.php 100.0% 0.0% 100.0% modified
src/Generator/Project/DatabaseChoice.php 100.0% 0.0% 100.0% modified
src/Generator/Project/DatabaseSetup.php 100.0% +100.0% 100.0% added
src/Generator/Project/MvcSkeleton.php 100.0% 0.0% 100.0% modified
src/Project/Bootstrap.php 100.0% 0.0% 100.0% modified

Reported by octocov

@niden niden mentioned this pull request Nov 22, 2026
3 of 4 tasks
@niden
niden merged commit 17a1457 into master Nov 27, 2026
40 checks passed
@niden
niden deleted the T95-make-database-sqlite branch November 27, 2026 15:42
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.

1 participant