Skip to content

T97 make database existing project - #108

Merged
niden merged 5 commits into
masterfrom
T97-make-database-existing-project
Nov 27, 2026
Merged

niden merged 5 commits into
masterfrom
T97-make-database-existing-project

Conversation

@niden

@niden niden commented Nov 27, 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

The checks of a project that exists, for make:database.

A db service that exists: when the provider folder has no DbProvider.php, make:database starts the front controller of the bootstrap key, if it can, and stops when the container (a Phalcon DI or a Phalcon\Container) has a db service. A front controller that does not start, for example with no vendor/, or no front controller, does not stop it. With DbProvider.php, the check of the file of #95 decides, so --force still writes DbProvider again: DbProvider gives the db service itself. The check is DatabaseSetup::checkContainer(), and only make:database calls it: init --database runs before the project has its autoloader.

No front controller (no bootstrap key): make:database and init --database print the line for the container of the project, from the new stub fragment-guidance-database-no-front of each flavor, and no line for a front. MVC: $di->register(new \App\Providers\DbProvider($projectRoot));. ADR: (new \App\Provider\DbProvider($projectRoot))->provide($container);. A SQLite provider gets $projectRoot, because there is no $this->projectRoot with no front: DatabaseChoice::arguments() takes the root as an optional parameter.

The tests of the front lines now name a front in crest.php: before, their crest.php had no bootstrap key. The database test of the MVC flavor puts the printed line into a copy of the front, as the ADR test does: make:database now loads the front, so the process cannot load a changed AppFront.

Not in scope (#97): MVC on v6 prints no composer require phalcon/phql, because phalcon/phalcon 6.0.0 requires phalcon/phql (#100).

Stacked on #107.

Thanks

@niden niden mentioned this pull request Nov 27, 2026
2 of 4 tasks
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@niden
niden force-pushed the T101-make-model-all-no-sequences-partitions branch from 7343e92 to 6d34b25 Compare November 27, 2026 22:19
@github-actions

This comment has been minimized.

Base automatically changed from T101-make-model-all-no-sequences-partitions to master November 27, 2026 22:27
@niden
niden force-pushed the T97-make-database-existing-project branch from 7f7cc85 to ea2d622 Compare November 27, 2026 22:28
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

Code Metrics Report

master (2156f2e) #108 (d7f1b2c) +/-
Coverage 99.8% 99.8% +0.0%
Test Execution Time 10s 12s +2s
Details
  |                     | master (2156f2e) | #108 (d7f1b2c) |  +/-  |
  |---------------------|------------------|----------------|-------|
+ | Coverage            |            99.8% |          99.8% | +0.0% |
  |   Files             |               97 |             97 |     0 |
  |   Lines             |             4003 |           4028 |   +25 |
+ |   Covered           |             3996 |           4021 |   +25 |
- | Test Execution Time |              10s |            12s |   +2s |

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

Files Coverage +/- Patch Coverage Status
src/Command/Make/DatabaseCommand.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% 0.0% 100.0% modified

Reported by octocov

@niden
niden merged commit e2b33ef into master Nov 27, 2026
40 checks passed
@niden
niden deleted the T97-make-database-existing-project branch November 27, 2026 22:36
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