fuzzyma/contao-database-commands-bundle

Commands to update the contao database or add an admin entry

0.2.4 2018-12-04 19:55 UTC

This package is not auto-updated.

Last update: 2024-11-15 07:36:57 UTC


README

No need for the install tool anymore. This Bundle comes with a command to update the database to reflect all changed made in the dca files. Furthermore you can now add admin user per command, accept the license and do the whole first setup process with one command!

Installation

Step 1: Install the bundle

composer require fuzzyma/contao-database-commands-bundle

Step 2: Register the bundle

Open your AppKernel.php and add the following line in the dev/test section:

$bundles[] = new Fuzzyma\Contao\DatabaseCommandsBundle\ContaoDatabaseCommandsBundle();

or use the composer plugin to register bundles: ComposerRegisterBundlePlugin

Usage

The following commands are available:

  • contao:database:update | Updates the database to the current dca state
  • contao:database:addAdmin | Adds a new admin user
  • contao:license | Accepts the license
  • contao:setup | Creates Database and runs all other commands to perform a full contao setup

contao:database:update

bin/console contao:database:update -d        // updates the database INCLUDING [d]rops
bin/console contao:database:update --dry-run // only prints queries. database is left untouched

contao:database:addAdmin

bin/console contao:database:addAdmin // creates a new admin user interactively
bin/console contao:database:addAdmin -u username -a name -m mail -p password // for the pros
bin/console contao:database:addAdmin --force // will add admin even if admin user already present in tl_user table

contao:license

bin/console contao:license       // accept the license interactively
bin/console contao:license --yes // accept the license directly

contao:setup

bin/console contao:setup // do all together + creates database if not exists

Register database updates to the composer post-update-cmd

Just add the following to the post-update-cmd array in your composer.json:

php bin/console contao:database:update