Integrate Propel clean command

Edit on GitHub

The propel:database:drop command is used to clean a database of all the tables, indexes, counters and so on. The command invokes the drop process to delete and re-create the database from scratch.

When working with a remote database, you might have insufficient permissions to invoke the drop process. To cover the case, the vendor/bin/console propel:tables:drop command was introduced. The command cleans the database without dropping it.

To integrate the command, follow the steps.

Prerequisites

Install the following features:

NAME VERSION REQUIRED SUB-FEATURE
Spryker Core 202404.0 Feature

1) Install the required modules

Install the required modules using Composer:

composer require spryker/propel:"^3.10.0" --update-with-dependencies
Verification

Make sure that the following module has been installed:

MODULE EXPECTED DIRECTORY
Propel vendor/spryker/propel

2) Set up behavior

  1. Clean up Codeception configuration by deleting SetupHelper from all Codeception configuration files:
- \SprykerTest\Shared\Application\Helper\SetupHelper

Use SprykerTest\Shared\Testify\Helper\DataCleanupHelper instead to clean up data after each test that can intersect with other tests.

  1. Enable the DatabaseDropTablesConsole console command in Pyz\Zed\Console\ConsoleDependencyProvider:

src/Pyz/Zed/Console/ConsoleDependencyProvider.php

    <?php
    class ConsoleDependencyProvider extends SprykerConsoleDependencyProvider
{
    /**
     * @param \Spryker\Zed\Kernel\Container $container
     *
     * @return \Symfony\Component\Console\Command\Command[]
     */
    protected function getConsoleCommands(Container $container)
    {
        $commands = [
            ...
            new DatabaseDropTablesConsole(),
            ...
  • Spryker\Zed\Propel\Communication\Console\DatabaseExportConsole is deprecated.
  • Spryker\Zed\Propel\Communication\Console\DatabaseImportConsole is deprecated.
  1. Run vendor/bin/console and make sure the propel:tables:drop command is in the list.