Skip to content

[NFR]: make:database and init --database: the command, and SQLite #95

Description

@niden

Part of #82.

crest make:database <driver> adds a database to a project that exists. It is a project command: it reads crest.php (flavor, namespace, provider path, front controller, runtime). crest init --database=<driver> writes crest.php, then runs the same step. Thus a project from crest new with no database, and a project with no crest.php, can both get a database.

Crest changes no file that exists. It writes only the new files, and prints the lines to add to each file that exists, as make:provider and make:module do.

Scope

  • make:database <driver>, and init --database=none|mariadb|mysql|pgsql|sqlite with its question, as in new.
  • DbProvider in the provider path, for each flavor, from the stubs of new: for MVC the Phalcon\Db adapter, for ADR the DataMapper Connection with the alias db.
  • SQLite: storage/database.sqlite and storage/.gitkeep, when they do not exist. Crest never replaces the database file, also with --force.
  • The printed lines: the registration of DbProvider in the front controller (MVC: providers(); ADR: the guidance of make:provider, which knows an existing registerProviders()), /storage/database.sqlite for .gitignore, and DB_NAME for .env.
  • A second run stops when DbProvider.php is in the provider path. --force writes it again.
  • DB_NAME and DB_USERNAME come from the folder name of the project, as new uses its name.
  • MySQL, MariaDB and PostgreSQL: the server databases sub-issue of [NFR]: crest init --database: add a database to a project that exists #82.

Done when

  • In a project that exists, from crest new with no database and with no crest.php, --database=sqlite gives a working db service after the printed front line, in each flavor.
  • Tests, the docs and the CHANGELOG.

Activity

  1. added
    enhancement
    on Nov 22, 2026
  2. self-assigned this
    on Nov 22, 2026
  3. added theissue type on Nov 22, 2026
  4. added 3 commits that reference this issue on Nov 27, 2026
  5. niden commented on Nov 27, 2026

    @niden
    SponsorMemberAuthor

    Resolved in #98

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions