Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mautic:migrations:generate command replaced with doctrine:migrations:generate #8429

Merged
merged 5 commits into from Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -44,4 +44,4 @@ jobs:
script: composer rector -- --dry-run --no-progress-bar
-
name: CS Fixer
script: bin/php-cs-fixer fix --config=.php_cs -v --dry-run --using-cache=no --show-progress=dots --diff $(git diff --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}")
script: bin/php-cs-fixer fix --config=.php_cs -v --dry-run --using-cache=no --show-progress=dots --diff $(git diff -- '*.php' --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}")
1 change: 1 addition & 0 deletions UPGRADE-3.0.md
Expand Up @@ -103,6 +103,7 @@ All fixtures must be defined as services in a bundle's config.php
* Removed deprecated \Mautic\CoreBundle\Templating\Helper\ButtonHelper::renderPreCustomButtons use renderButtons() instead
* Removed deprecated \Mautic\CoreBundle\Templating\Helper\ButtonHelper::renderPostCustomButtons
* Removed deprecated \Mautic\CoreBundle\Templating\Helper\ButtonHelper::setCustomButtons; listen to CoreEvents::VIEW_INJECT_CUSTOM_BUTTONS event instead
* Removed command class GenerateMigrationsCommand as it was broken with new Doctrine. Instead of `mautic:migrations:generate` use command `doctrine:migrations:generate` to generate a migration class.
* Abstract class CommonStatsSubscriber was refactored out of CommonSubscriber and so it needs its own dependencies: CorePermissions and EntityManager. All classes extending CommonStatsSubscriber must provide those dependencies.
* Protected methods CommonStatsSubscriber::addContactRestrictedRepositories() and CommonStatsSubscriber::addContactRestrictedRepositories() do not have the first parameter of EntityManager. See the point above. The second parameter must be an array now.
* CommonSubscriber removed. Implement Symfony\Component\EventDispatcher\EventSubscriberInterface directly and use DI instead.
Expand Down
140 changes: 0 additions & 140 deletions app/bundles/CoreBundle/Command/GenerateMigrationsCommand.php

This file was deleted.

9 changes: 5 additions & 4 deletions app/config/config.php
Expand Up @@ -300,10 +300,11 @@ function ($v) {

//MigrationsBundle Configuration
$container->loadFromExtension('doctrine_migrations', [
'dir_name' => '%kernel.root_dir%/migrations',
'namespace' => 'Mautic\\Migrations',
'table_name' => '%env(MAUTIC_MIGRATIONS_TABLE_NAME)%',
'name' => 'Mautic Migrations',
'dir_name' => '%kernel.root_dir%/migrations',
'namespace' => 'Mautic\\Migrations',
'table_name' => '%env(MAUTIC_MIGRATIONS_TABLE_NAME)%',
'name' => 'Mautic Migrations',
'custom_template' => '%kernel.root_dir%/migrations/Migration.template',
]);

// Swiftmailer Configuration
Expand Down
36 changes: 36 additions & 0 deletions app/migrations/Migration.template
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

/*
* @copyright <year> Mautic Contributors. All rights reserved.
* @author Mautic
* @link https://mautic.org
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/

namespace Mautic\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\Exception\SkipMigration;
use Mautic\CoreBundle\Doctrine\AbstractMauticMigration;

final class Version<version> extends AbstractMauticMigration
{
/**
* @throws SkipMigrationException
*/
public function preUp(Schema $schema)
{
$shouldRunMigration = false; // Please modify to your needs

if (!$shouldRunMigration) {
throw new SkipMigration('Schema includes this migration');
}
}

public function up(Schema $schema)
{
// Please modify to your needs
}
}
1 change: 0 additions & 1 deletion phpstan.neon
Expand Up @@ -25,5 +25,4 @@ parameters:
- '#Constant MAUTIC_TABLE_PREFIX not found.#'
- '#Constant MAUTIC_ENV not found.#'
- '#Constant MAUTIC_VERSION not found.#'
- '#Constant MAUTIC_ROOT_DIR not found.#'
- '/Variable \$\w+ might not be defined\./'