Register generate:migration

@return Commands\MigrationGeneratorCommand
483774
protected function registerMigrationGenerator()
	{
		$this->app['generate.migration'] = $this->app->share(function($app)
		{
			$cache = new Cache($app['files']);
			$generator = new Generators\MigrationGenerator($app['files'], $cache);

			return new Commands\MigrationGeneratorCommand($generator);
		});
	}
753985
public function generate(): int
    {
        $schema = $this->dba->getSchema();
        $oldSchema = $this->getOldSchema($this->settings);
        $diffs = $this->compareSchema($schema, $oldSchema);

        if (empty($diffs[0]) && empty($diffs[1])) {
            $this->output->writeln('No database changes detected.');

            return 1;
        }

        if (empty($this->settings['name'])) {
            $name = $this->io->ask('Enter migration name', '');
        } else {
            $name = $this->settings['name'];
        }
        if (empty($name)) {
            $this->output->writeln('Aborted');

            return 1;
        }
        $path = $this->settings['migration_path'];
        $className = $this->createClassName($name);

        if (!Util::isValidPhinxClassName($className)) {
            throw new InvalidArgumentException(sprintf(
                'The migration class name "%s" is invalid. Please use CamelCase format.',
                $className
            ));
        }

        if (!Util::isUniqueMigrationClassName($className, $path)) {
            throw new InvalidArgumentException(sprintf(
                'The migration class name "%s" already exists',
                $className
            ));
        }

        // Compute the file path
        $fileName = Util::mapClassNameToFileName($className);
        $filePath = $path . DIRECTORY_SEPARATOR . $fileName;

        if (is_file($filePath)) {
            throw new InvalidArgumentException(sprintf(
                'The file "%s" already exists',
                $filePath
            ));
        }

        $migration = $this->generator->createMigration($className, $schema, $oldSchema);
        $this->saveMigrationFile($filePath, $migration);

        // Mark migration as as completed
        if (!empty($this->settings['mark_migration'])) {
            $this->markMigration($className, $fileName);
        }

        // Overwrite schema file
        // http://symfony.com/blog/new-in-symfony-2-8-console-style-guide
        if (!empty($this->settings['overwrite'])) {
            $overwrite = 'y';
        } else {
            $overwrite = $this->io->ask('Overwrite schema file? (y, n)', 'n');
        }
        if ($overwrite == 'y') {
            $this->saveSchemaFile($schema, $this->settings);
        }
        $this->output->writeln('');
        $this->output->writeln('Generate migration finished');

        return 0;
    }
403576
protected function registerMakeMigrationCommand()
    {
        $this->app->singleton('pluggables.makeMigration', function ($app) {
            $handler = new Handlers\PluggableMakeMigrationHandler($app['pluggables'], $app['files']);

            return new Console\PluggableMakeMigrationCommand($handler);
        });
    }
1295859
protected function registerCommands()
    {
        $this->app->singleton('revisions.migration', function ($app) {
            return new RevisionsTableCommand($app['files'], $app['composer']);
        });
        $this->app->singleton('revisions.upgrade5_3', function ($app) {
            return new RevisionsUpgradeCommand($app['files'], $app['composer']);
        });

        $this->commands([
            'revisions.migration',
            'revisions.upgrade5_3',
        ]);
    }
955909
protected function createBaseMigration()
    {
        $name = 'create_notifications_table';

        $path = $this->laravel->databasePath().'/migrations';

        return $this->laravel['migration.creator']->create($name, $path);
    }
832764
public function generate()
    {
        $version = date('YmdHis');

        $this->_generateMigrationFile($version);
        print PHP_EOL . Color::success('Version ' . $version . ' was successfully generated') . PHP_EOL;
    }
980870
protected function registerMakeCommand(): void
    {
        $this->app->singleton('orchestra.tenanti.creator', function (Application $app) {
            return new Creator($app->make('files'));
        });

        $this->app->singleton('orchestra.commands.tenanti.make', function (Application $app) {
            // Once we have the migration creator registered, we will create the command
            // and inject the creator. The creator is responsible for the actual file
            // creation of the migrations, and may be extended by these developers.
            return new MigrateMakeCommand(
                $app->make('orchestra.tenanti'),
                $app->make('orchestra.tenanti.creator'),
                $app->make('composer')
            );
        });
    }
1023925
public function process()
    {
        $this->argumentName = $this->argument('name');
        $this->appDir = CYGNITE_BASE.DS.APPPATH;
        $migrateTemplateDir =
            dirname(dirname(__FILE__)).DS.'src'.DS.'Apps'.DS.'Database'.DS;

        $migrateInstance = null;
        $migrateInstance = Migrator::instance($this);
        $this->table()->makeMigration('migrations');

        // We will generate migration class only if class name provided in command
        if (!is_null($this->argumentName)) {
            $migrateInstance->setTemplateDir($migrateTemplateDir);
            $migrateInstance->replaceTemplateByInput();
            $file = $migrateInstance->generate(new \DateTime('now', new \DateTimeZone(SET_TIME_ZONE)));

            if ($file) {
                $file = APP_NS.DS.'Resources'.DS.'Database'.DS.'Migrations'.DS.$file;
                $this->info('Your migration class generated in '.$file);
            }

            $this->info('Cool!! You are ready to use migration!');
        }
    }
823700
protected function registerModelGenerator()
	{
		$this->app['generate.model'] = $this->app->share(function($app)
		{
			$cache = new Cache($app['files']);
			$generator = new Generators\ModelGenerator($app['files'], $cache);

			return new Commands\ModelGeneratorCommand($generator);
		});
	}
1367147
protected function registerMigrateCommand()
    {
        $this->app->singleton('command.migrate', function ($app) {
            $packagePath = $app->make('path.base') . '/vendor';

            $command = new MigrateCommand($app->make('migrator'));

            return $command->setPackagePath($packagePath);
        });
    }
249560
protected function registerMigrateCommand()
	{
		$this->app->bindShared('command.migrate', function($app)
		{
			$packagePath = $app['path.base'].'/vendor';

			return new MigrateCommand($app['migrator'], $packagePath);
		});
	}
984301
public function register()
	{
		$this->registerModelGenerator();
		$this->registerControllerGenerator();
		$this->registerTestGenerator();
		$this->registerResourceGenerator();
		$this->registerScaffoldGenerator();
		$this->registerViewGenerator();
		$this->registerMigrationGenerator();
		$this->registerPivotGenerator();
		$this->registerSeedGenerator();
		$this->registerFormDumper();

		$this->commands(
			'generate.model',
			'generate.controller',
			'generate.test',
			'generate.scaffold',
			'generate.resource',
			'generate.view',
			'generate.migration',
			'generate.seed',
			'generate.form',
			'generate.pivot'
		);
	}
983616
protected function registerCommands()
    {
        $this->app->singleton('migrate.entity', function ($app){

            $packagePath = $app['path.base'] . '/vendor';

            return new MigrateEntity($app['entity.creator'], $packagePath);
        });
    }
12417
private function registerRepository()
    {
        $this->app->singleton('migration.repository', function ($app) {
            $table = $app['config']['database.migrations'];

            return new DatabaseMigrationRepository($app['db'], $table);
        });
    }
77930
protected function registerMakeMigrationCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Database\Commands\MigrationMakeCommand($app);
        });
    }
731025
public function registerCommands()
    {
        $this->app->singleton('command.database.status', function ($app) {
            return new Commands\DatabaseStatusCommand();
        });

        $this->app->singleton('command.database.upgrade', function ($app) {
            return new Commands\DatabaseUpgradeCommand();
        });

        $this->app->singleton('command.database.clean', function ($app) {
            return new Commands\DatabaseCleanCommand();
        });

        $this->app->singleton('command.database.refresh', function ($app) {
            return new Commands\DatabaseRefreshCommand();
        });

        $this->app->singleton('command.database.rollback', function ($app) {
            return new Commands\DatabaseRollbackCommand();
        });

        $this->app->singleton('command.database.again', function ($app) {
            return new Commands\DatabaseAgainCommand();
        });

        $this->app->singleton('command.database.seed', function ($app) {
            return new Commands\DatabaseSeedCommand();
        });

        $this->app->singleton('command.migration.make', function ($app) {
            return new Commands\MigrationMakeCommand();
        });

        $this->app->singleton('command.seeder.make', function ($app) {
            return new Commands\SeederMakeCommand();
        });

        $this->commands([
            'command.database.status',
            'command.database.upgrade',
            'command.database.clean',
            'command.database.refresh',
            'command.database.rollback',
            'command.database.again',
            'command.database.seed',
            'command.migration.make',
            'command.seeder.make',
        ]);
    }
1072927
protected function registerGenerator()
	{
		$this->app->bindShared('command.controller.make', function($app)
		{
			// The controller generator is responsible for building resourceful controllers
			// quickly and easily for the developers via the FlyConsole CLI. We'll go ahead
			// and register this command instances in this container for registration.
			$path = $app['path'].'/controllers';

			$generator = new ControllerGenerator($app['files']);

			return new MakeControllerCommand($generator, $path);
		});
	}