mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 11:48:08 +08:00
Merge branch 'master' of github.com:hyperf-cloud/hyperf
This commit is contained in:
commit
4d5368fbec
9
LICENSE.md
Normal file
9
LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/amqp/LICENSE.md
Normal file
9
src/amqp/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/async-queue/LICENSE.md
Normal file
9
src/async-queue/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/cache/LICENSE.md
vendored
Normal file
9
src/cache/LICENSE.md
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/circuit-breaker/LICENSE.md
Normal file
9
src/circuit-breaker/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/command/LICENSE.md
Normal file
9
src/command/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -17,6 +17,7 @@ use Hyperf\Utils\Str;
|
||||
use Symfony\Component\Console\Command\Command as SymfonyCommand;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
@ -250,6 +251,19 @@ abstract class Command extends SymfonyCommand
|
||||
$this->output->newLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* Call another console command.
|
||||
*/
|
||||
public function call(string $command, array $arguments = []): int
|
||||
{
|
||||
$arguments['command'] = $command;
|
||||
|
||||
return $this->getApplication()->find($command)->run(
|
||||
$this->createInputFromArguments($arguments),
|
||||
$this->output
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the verbosity level.
|
||||
* @param mixed $level
|
||||
@ -273,6 +287,34 @@ abstract class Command extends SymfonyCommand
|
||||
return $level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an input instance from the given arguments.
|
||||
*/
|
||||
protected function createInputFromArguments(array $arguments): ArrayInput
|
||||
{
|
||||
return tap(new ArrayInput(array_merge($this->context(), $arguments)), function (InputInterface $input) {
|
||||
if ($input->hasParameterOption(['--no-interaction'], true)) {
|
||||
$input->setInteractive(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the context passed to the command.
|
||||
*/
|
||||
protected function context(): array
|
||||
{
|
||||
return collect($this->input->getOptions())->only([
|
||||
'ansi',
|
||||
'no-ansi',
|
||||
'no-interaction',
|
||||
'quiet',
|
||||
'verbose',
|
||||
])->filter()->mapWithKeys(function ($value, $key) {
|
||||
return ["--{$key}" => $value];
|
||||
})->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the arguments and options on the command.
|
||||
*/
|
||||
@ -308,5 +350,5 @@ abstract class Command extends SymfonyCommand
|
||||
/**
|
||||
* Handle the current command.
|
||||
*/
|
||||
abstract protected function handle();
|
||||
abstract public function handle();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ trait ConfirmableTrait
|
||||
* @param \Closure|bool|null $callback
|
||||
* @return bool
|
||||
*/
|
||||
public function confirmToProceed($warning = 'Application In Production!', $callback)
|
||||
public function confirmToProceed($warning = 'Application In Production!', $callback = false)
|
||||
{
|
||||
$shouldConfirm = $callback instanceof Closure ? call_user_func($callback) : $callback;
|
||||
|
||||
|
9
src/config-apollo/LICENSE.md
Normal file
9
src/config-apollo/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/config/LICENSE.md
Normal file
9
src/config/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/constants/LICENSE.md
Normal file
9
src/constants/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/consul/LICENSE.md
Normal file
9
src/consul/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/contract/LICENSE.md
Normal file
9
src/contract/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/database/LICENSE.md
Normal file
9
src/database/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -45,7 +45,7 @@ abstract class BaseCommand extends Command
|
||||
*/
|
||||
protected function usingRealPath()
|
||||
{
|
||||
return $this->input->hasOption('realpath') && $this->option('realpath');
|
||||
return $this->input->hasOption('realpath') && $this->input->getOption('realpath');
|
||||
}
|
||||
|
||||
/**
|
||||
|
152
src/database/src/Commands/Migrations/FreshCommand.php
Normal file
152
src/database/src/Commands/Migrations/FreshCommand.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Commands\Migrations;
|
||||
|
||||
use Hyperf\Command\Command;
|
||||
use Hyperf\Command\ConfirmableTrait;
|
||||
use Hyperf\Database\ConnectionResolverInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class FreshCommand extends Command
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'migrate:fresh';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Drop all tables and re-run all migrations';
|
||||
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$connection = $this->input->getOption('database') ?? 'default';
|
||||
|
||||
if ($this->input->getOption('drop-views')) {
|
||||
$this->dropAllViews($connection);
|
||||
|
||||
$this->info('Dropped all views successfully.');
|
||||
}
|
||||
|
||||
$this->dropAllTables($connection);
|
||||
|
||||
$this->info('Dropped all tables successfully.');
|
||||
|
||||
$this->call('migrate', array_filter([
|
||||
'--database' => $connection,
|
||||
'--path' => $this->input->getOption('path'),
|
||||
'--realpath' => $this->input->getOption('realpath'),
|
||||
'--force' => true,
|
||||
'--step' => $this->input->getOption('step'),
|
||||
]));
|
||||
|
||||
if ($this->needsSeeding()) {
|
||||
$this->runSeeder($connection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop all of the database tables.
|
||||
*/
|
||||
protected function dropAllTables(string $connection)
|
||||
{
|
||||
$this->container->get(ConnectionResolverInterface::class)
|
||||
->connection($connection)
|
||||
->getSchemaBuilder()
|
||||
->dropAllTables();
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop all of the database views.
|
||||
*/
|
||||
protected function dropAllViews(string $connection)
|
||||
{
|
||||
$this->container->get(ConnectionResolverInterface::class)
|
||||
->connection($connection)
|
||||
->getSchemaBuilder()
|
||||
->dropAllViews();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the developer has requested database seeding.
|
||||
*/
|
||||
protected function needsSeeding(): bool
|
||||
{
|
||||
return $this->input->getOption('seed') || $this->input->getOption('seeder');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the database seeder command.
|
||||
*/
|
||||
protected function runSeeder(string $database)
|
||||
{
|
||||
$this->call('db:seed', array_filter([
|
||||
'--database' => $database,
|
||||
'--class' => $this->input->getOption('seeder') ?: 'DatabaseSeeder',
|
||||
'--force' => true,
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*/
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return [
|
||||
['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'],
|
||||
['drop-views', null, InputOption::VALUE_NONE, 'Drop all tables and views'],
|
||||
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'],
|
||||
['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed'],
|
||||
[
|
||||
'realpath',
|
||||
null,
|
||||
InputOption::VALUE_NONE,
|
||||
'Indicate any provided migration file paths are pre-resolved absolute paths',
|
||||
],
|
||||
['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run'],
|
||||
['seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder'],
|
||||
[
|
||||
'step',
|
||||
null,
|
||||
InputOption::VALUE_NONE,
|
||||
'Force the migrations to be run so they can be rolled back individually',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
@ -1,14 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Commands\Migrations;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Hyperf\Database\Migrations\MigrationRepositoryInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class InstallCommand extends Command
|
||||
class InstallCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
@ -31,46 +38,28 @@ class InstallCommand extends Command
|
||||
*/
|
||||
protected $repository;
|
||||
|
||||
/**
|
||||
* The input interface implementation.
|
||||
*
|
||||
* @var InputInterface
|
||||
*/
|
||||
protected $input;
|
||||
|
||||
/**
|
||||
* The output interface implementation.
|
||||
*
|
||||
* @var OutputInterface
|
||||
*/
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* Create a new migration install command instance.
|
||||
*
|
||||
* @param \Hyperf\Database\Migrations\MigrationRepositoryInterface $repository
|
||||
* @return void
|
||||
* @param MigrationRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(MigrationRepositoryInterface $repository)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->specifyParameters();
|
||||
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
* Handle the current command.
|
||||
*/
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
public function handle()
|
||||
{
|
||||
$this->repository->setSource($input->getOption('database'));
|
||||
$this->repository->setSource($this->input->getOption('database'));
|
||||
|
||||
$this->repository->createRepository();
|
||||
|
||||
$output->writeln('<info>Migration table created successfully.</info>');
|
||||
$this->output->writeln('<info>[INFO] Migration table created successfully.</info>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,25 +73,4 @@ class InstallCommand extends Command
|
||||
['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the arguments and options on the command.
|
||||
*/
|
||||
protected function specifyParameters(): void
|
||||
{
|
||||
// We will loop through all of the arguments and options for the command and
|
||||
// set them all on the base command instance. This specifies what can get
|
||||
// passed into these commands as "parameters" to control the execution.
|
||||
if (method_exists($this, 'getArguments')) {
|
||||
foreach ($this->getArguments() ?? [] as $arguments) {
|
||||
call_user_func_array([$this, 'addArgument'], $arguments);
|
||||
}
|
||||
}
|
||||
|
||||
if (method_exists($this, 'getOptions')) {
|
||||
foreach ($this->getOptions() ?? [] as $options) {
|
||||
call_user_func_array([$this, 'addOption'], $options);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
105
src/database/src/Commands/Migrations/MigrateCommand.php
Executable file
105
src/database/src/Commands/Migrations/MigrateCommand.php
Executable file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Commands\Migrations;
|
||||
|
||||
use Hyperf\Command\ConfirmableTrait;
|
||||
use Hyperf\Database\Migrations\Migrator;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class MigrateCommand extends BaseCommand
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
protected $name = 'migrate';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Run the database migrations';
|
||||
|
||||
/**
|
||||
* The migrator instance.
|
||||
*
|
||||
* @var \Hyperf\Database\Migrations\Migrator
|
||||
*/
|
||||
protected $migrator;
|
||||
|
||||
/**
|
||||
* Create a new migration command instance.
|
||||
*
|
||||
* @param \Hyperf\Database\Migrations\Migrator $migrator
|
||||
*/
|
||||
public function __construct(Migrator $migrator)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->migrator = $migrator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->prepareDatabase();
|
||||
|
||||
// Next, we will check to see if a path option has been defined. If it has
|
||||
// we will use the path relative to the root of this installation folder
|
||||
// so that migrations may be run for any path within the applications.
|
||||
$this->migrator->setOutput($this->output)
|
||||
->run($this->getMigrationPaths(), [
|
||||
'pretend' => $this->input->getOption('pretend'),
|
||||
'step' => $this->input->getOption('step'),
|
||||
]);
|
||||
|
||||
// Finally, if the "seed" option has been given, we will re-run the database
|
||||
// seed task to re-populate the database, which is convenient when adding
|
||||
// a migration and a seed at the same time, as it is only this command.
|
||||
if ($this->input->getOption('seed') && ! $this->input->getOption('pretend')) {
|
||||
$this->call('db:seed', ['--force' => true]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return [
|
||||
['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'],
|
||||
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'],
|
||||
['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed'],
|
||||
['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'],
|
||||
['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run'],
|
||||
['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run'],
|
||||
['step', null, InputOption::VALUE_NONE, 'Force the migrations to be run so they can be rolled back individually'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the migration database for running.
|
||||
*/
|
||||
protected function prepareDatabase()
|
||||
{
|
||||
$this->migrator->setConnection($this->input->getOption('database') ?? 'default');
|
||||
|
||||
if (! $this->migrator->repositoryExists()) {
|
||||
$this->call('migrate:install', array_filter([
|
||||
'--database' => $this->input->getOption('database'),
|
||||
]));
|
||||
}
|
||||
}
|
||||
}
|
143
src/database/src/Commands/Migrations/RefreshCommand.php
Executable file
143
src/database/src/Commands/Migrations/RefreshCommand.php
Executable file
@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Commands\Migrations;
|
||||
|
||||
use Hyperf\Command\Command;
|
||||
use Hyperf\Command\ConfirmableTrait;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class RefreshCommand extends Command
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'migrate:refresh';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Reset and re-run all migrations';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Next we'll gather some of the options so that we can have the right options
|
||||
// to pass to the commands. This includes options such as which database to
|
||||
// use and the path to use for the migration. Then we'll run the command.
|
||||
$connection = $this->input->getOption('database') ?? 'default';
|
||||
|
||||
$path = $this->input->getOption('path');
|
||||
|
||||
// If the "step" option is specified it means we only want to rollback a small
|
||||
// number of migrations before migrating again. For example, the user might
|
||||
// only rollback and remigrate the latest four migrations instead of all.
|
||||
$step = $this->input->getOption('step') ?: 0;
|
||||
|
||||
if ($step > 0) {
|
||||
$this->runRollback($connection, $path, $step);
|
||||
} else {
|
||||
$this->runReset($connection, $path);
|
||||
}
|
||||
|
||||
// The refresh command is essentially just a brief aggregate of a few other of
|
||||
// the migration commands and just provides a convenient wrapper to execute
|
||||
// them in succession. We'll also see if we need to re-seed the database.
|
||||
$this->call('migrate', array_filter([
|
||||
'--database' => $connection,
|
||||
'--path' => $path,
|
||||
'--realpath' => $this->input->getOption('realpath'),
|
||||
'--force' => true,
|
||||
]));
|
||||
|
||||
if ($this->needsSeeding()) {
|
||||
$this->runSeeder($connection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the rollback command.
|
||||
*/
|
||||
protected function runRollback(string $database, string $path, int $step): void
|
||||
{
|
||||
$this->call('migrate:rollback', array_filter([
|
||||
'--database' => $database,
|
||||
'--path' => $path,
|
||||
'--realpath' => $this->input->getOption('realpath'),
|
||||
'--step' => $step,
|
||||
'--force' => true,
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the reset command.
|
||||
*/
|
||||
protected function runReset(string $database, string $path): void
|
||||
{
|
||||
$this->call('migrate:reset', array_filter([
|
||||
'--database' => $database,
|
||||
'--path' => $path,
|
||||
'--realpath' => $this->input->getOption('realpath'),
|
||||
'--force' => true,
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the developer has requested database seeding.
|
||||
*/
|
||||
protected function needsSeeding(): bool
|
||||
{
|
||||
return $this->input->getOption('seed') || $this->input->getOption('seeder');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the database seeder command.
|
||||
*/
|
||||
protected function runSeeder(string $database): void
|
||||
{
|
||||
$this->call('db:seed', array_filter([
|
||||
'--database' => $database,
|
||||
'--class' => $this->input->getOption('seeder') ?: 'DatabaseSeeder',
|
||||
'--force' => true,
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'],
|
||||
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'],
|
||||
['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed'],
|
||||
['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'],
|
||||
['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run'],
|
||||
['seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder'],
|
||||
['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted & re-run'],
|
||||
];
|
||||
}
|
||||
}
|
93
src/database/src/Commands/Migrations/ResetCommand.php
Executable file
93
src/database/src/Commands/Migrations/ResetCommand.php
Executable file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Commands\Migrations;
|
||||
|
||||
use Hyperf\Command\ConfirmableTrait;
|
||||
use Hyperf\Database\Migrations\Migrator;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class ResetCommand extends BaseCommand
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'migrate:reset';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Rollback all database migrations';
|
||||
|
||||
/**
|
||||
* The migrator instance.
|
||||
*
|
||||
* @var \Hyperf\Database\Migrations\Migrator
|
||||
*/
|
||||
protected $migrator;
|
||||
|
||||
/**
|
||||
* Create a new migration rollback command instance.
|
||||
*/
|
||||
public function __construct(Migrator $migrator)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->migrator = $migrator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->migrator->setConnection($this->input->getOption('database') ?? 'default');
|
||||
|
||||
// First, we'll make sure that the migration table actually exists before we
|
||||
// start trying to rollback and re-run all of the migrations. If it's not
|
||||
// present we'll just bail out with an info message for the developers.
|
||||
if (! $this->migrator->repositoryExists()) {
|
||||
return $this->comment('Migration table not found.');
|
||||
}
|
||||
|
||||
$this->migrator->setOutput($this->output)->reset(
|
||||
$this->getMigrationPaths(),
|
||||
$this->input->getOption('pretend')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'],
|
||||
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'],
|
||||
['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'],
|
||||
['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'],
|
||||
['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run'],
|
||||
];
|
||||
}
|
||||
}
|
90
src/database/src/Commands/Migrations/RollbackCommand.php
Executable file
90
src/database/src/Commands/Migrations/RollbackCommand.php
Executable file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Commands\Migrations;
|
||||
|
||||
use Hyperf\Command\ConfirmableTrait;
|
||||
use Hyperf\Database\Migrations\Migrator;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class RollbackCommand extends BaseCommand
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'migrate:rollback';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Rollback the last database migration';
|
||||
|
||||
/**
|
||||
* The migrator instance.
|
||||
*
|
||||
* @var \Hyperf\Database\Migrations\Migrator
|
||||
*/
|
||||
protected $migrator;
|
||||
|
||||
/**
|
||||
* Create a new migration rollback command instance.
|
||||
*/
|
||||
public function __construct(Migrator $migrator)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->migrator = $migrator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->migrator->setConnection($this->input->getOption('database') ?? 'default');
|
||||
|
||||
$this->migrator->setOutput($this->output)->rollback(
|
||||
$this->getMigrationPaths(),
|
||||
[
|
||||
'pretend' => $this->input->getOption('pretend'),
|
||||
'step' => (int) $this->input->getOption('step'),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'],
|
||||
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'],
|
||||
['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed'],
|
||||
['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'],
|
||||
['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run'],
|
||||
['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted'],
|
||||
];
|
||||
}
|
||||
}
|
116
src/database/src/Commands/Migrations/StatusCommand.php
Normal file
116
src/database/src/Commands/Migrations/StatusCommand.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Commands\Migrations;
|
||||
|
||||
use Hyperf\Database\Migrations\Migrator;
|
||||
use Hyperf\Utils\Collection;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class StatusCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'migrate:status';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Show the status of each migration';
|
||||
|
||||
/**
|
||||
* The migrator instance.
|
||||
*
|
||||
* @var \Hyperf\Database\Migrations\Migrator
|
||||
*/
|
||||
protected $migrator;
|
||||
|
||||
/**
|
||||
* Create a new migration rollback command instance.
|
||||
*/
|
||||
public function __construct(Migrator $migrator)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->migrator = $migrator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->migrator->setConnection($this->input->getOption('database') ?? 'default');
|
||||
|
||||
if (! $this->migrator->repositoryExists()) {
|
||||
return $this->error('Migration table not found.');
|
||||
}
|
||||
|
||||
$ran = $this->migrator->getRepository()->getRan();
|
||||
|
||||
$batches = $this->migrator->getRepository()->getMigrationBatches();
|
||||
|
||||
if (count($migrations = $this->getStatusFor($ran, $batches)) > 0) {
|
||||
$this->table(['Ran?', 'Migration', 'Batch'], $migrations);
|
||||
} else {
|
||||
$this->error('No migrations found');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status for the given ran migrations.
|
||||
*
|
||||
* @param array $ran
|
||||
* @param array $batches
|
||||
* @return \Hyperf\Support\Collection
|
||||
*/
|
||||
protected function getStatusFor(array $ran, array $batches)
|
||||
{
|
||||
return Collection::make($this->getAllMigrationFiles())
|
||||
->map(function ($migration) use ($ran, $batches) {
|
||||
$migrationName = $this->migrator->getMigrationName($migration);
|
||||
|
||||
return in_array($migrationName, $ran)
|
||||
? ['<info>Yes</info>', $migrationName, $batches[$migrationName]]
|
||||
: ['<fg=red>No</fg=red>', $migrationName];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of all of the migration files.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getAllMigrationFiles()
|
||||
{
|
||||
return $this->migrator->getMigrationFiles($this->getMigrationPaths());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'],
|
||||
['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to use'],
|
||||
['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'],
|
||||
];
|
||||
}
|
||||
}
|
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Commands\Migrations;
|
||||
|
||||
class TableGuesser
|
||||
|
@ -33,9 +33,9 @@ use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
class Connection implements ConnectionInterface
|
||||
{
|
||||
use DetectsDeadlocks,
|
||||
DetectsLostConnections,
|
||||
Concerns\ManagesTransactions;
|
||||
use DetectsDeadlocks;
|
||||
use DetectsLostConnections;
|
||||
use Concerns\ManagesTransactions;
|
||||
|
||||
/**
|
||||
* The active PDO connection.
|
||||
|
@ -15,9 +15,6 @@ namespace Hyperf\Database\Connectors;
|
||||
use Hyperf\Database\Connection;
|
||||
use Hyperf\Database\ConnectionInterface;
|
||||
use Hyperf\Database\MySqlConnection;
|
||||
use Hyperf\Database\PostgresConnection;
|
||||
use Hyperf\Database\SQLiteConnection;
|
||||
use Hyperf\Database\SqlServerConnection;
|
||||
use Hyperf\Utils\Arr;
|
||||
use InvalidArgumentException;
|
||||
use PDOException;
|
||||
@ -76,12 +73,6 @@ class ConnectionFactory
|
||||
switch ($config['driver']) {
|
||||
case 'mysql':
|
||||
return new MySqlConnector();
|
||||
case 'pgsql':
|
||||
return new PostgresConnector();
|
||||
case 'sqlite':
|
||||
return new SQLiteConnector();
|
||||
case 'sqlsrv':
|
||||
return new SqlServerConnector();
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException("Unsupported driver [{$config['driver']}]");
|
||||
@ -268,12 +259,6 @@ class ConnectionFactory
|
||||
switch ($driver) {
|
||||
case 'mysql':
|
||||
return new MySqlConnection($connection, $database, $prefix, $config);
|
||||
case 'pgsql':
|
||||
return new PostgresConnection($connection, $database, $prefix, $config);
|
||||
case 'sqlite':
|
||||
return new SQLiteConnection($connection, $database, $prefix, $config);
|
||||
case 'sqlsrv':
|
||||
return new SqlServerConnection($connection, $database, $prefix, $config);
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException("Unsupported driver [{$driver}]");
|
||||
|
@ -117,7 +117,7 @@ abstract class Grammar
|
||||
return implode(', ', array_map([$this, __FUNCTION__], $value));
|
||||
}
|
||||
|
||||
return "'${value}'";
|
||||
return "'{$value}'";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Migrations;
|
||||
|
||||
use Hyperf\Database\ConnectionResolverInterface as Resolver;
|
||||
@ -44,15 +54,15 @@ class DatabaseMigrationRepository implements MigrationRepositoryInterface
|
||||
public function getRan()
|
||||
{
|
||||
return $this->table()
|
||||
->orderBy('batch', 'asc')
|
||||
->orderBy('migration', 'asc')
|
||||
->pluck('migration')->all();
|
||||
->orderBy('batch', 'asc')
|
||||
->orderBy('migration', 'asc')
|
||||
->pluck('migration')->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of migrations.
|
||||
*
|
||||
* @param int $steps
|
||||
* @param int $steps
|
||||
* @return array
|
||||
*/
|
||||
public function getMigrations($steps)
|
||||
@ -60,8 +70,8 @@ class DatabaseMigrationRepository implements MigrationRepositoryInterface
|
||||
$query = $this->table()->where('batch', '>=', '1');
|
||||
|
||||
return $query->orderBy('batch', 'desc')
|
||||
->orderBy('migration', 'desc')
|
||||
->take($steps)->get()->all();
|
||||
->orderBy('migration', 'desc')
|
||||
->take($steps)->get()->all();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,17 +94,16 @@ class DatabaseMigrationRepository implements MigrationRepositoryInterface
|
||||
public function getMigrationBatches()
|
||||
{
|
||||
return $this->table()
|
||||
->orderBy('batch', 'asc')
|
||||
->orderBy('migration', 'asc')
|
||||
->pluck('batch', 'migration')->all();
|
||||
->orderBy('batch', 'asc')
|
||||
->orderBy('migration', 'asc')
|
||||
->pluck('batch', 'migration')->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Log that a migration was run.
|
||||
*
|
||||
* @param string $file
|
||||
* @param int $batch
|
||||
* @return void
|
||||
* @param string $file
|
||||
* @param int $batch
|
||||
*/
|
||||
public function log($file, $batch)
|
||||
{
|
||||
@ -106,8 +115,7 @@ class DatabaseMigrationRepository implements MigrationRepositoryInterface
|
||||
/**
|
||||
* Remove a migration from the log.
|
||||
*
|
||||
* @param object $migration
|
||||
* @return void
|
||||
* @param object $migration
|
||||
*/
|
||||
public function delete($migration)
|
||||
{
|
||||
@ -136,8 +144,6 @@ class DatabaseMigrationRepository implements MigrationRepositoryInterface
|
||||
|
||||
/**
|
||||
* Create the migration repository data store.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function createRepository()
|
||||
{
|
||||
@ -165,16 +171,6 @@ class DatabaseMigrationRepository implements MigrationRepositoryInterface
|
||||
return $schema->hasTable($this->table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a query builder for the migration table.
|
||||
*
|
||||
* @return \Hyperf\Database\Query\Builder
|
||||
*/
|
||||
protected function table()
|
||||
{
|
||||
return $this->getConnection()->table($this->table)->useWritePdo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the connection resolver instance.
|
||||
*
|
||||
@ -198,11 +194,20 @@ class DatabaseMigrationRepository implements MigrationRepositoryInterface
|
||||
/**
|
||||
* Set the information source to gather data.
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
* @param string $name
|
||||
*/
|
||||
public function setSource($name)
|
||||
{
|
||||
$this->connection = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a query builder for the migration table.
|
||||
*
|
||||
* @return \Hyperf\Database\Query\Builder
|
||||
*/
|
||||
protected function table()
|
||||
{
|
||||
return $this->getConnection()->table($this->table)->useWritePdo();
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Migrations;
|
||||
|
||||
abstract class Migration
|
||||
{
|
||||
/**
|
||||
* The name of the database connection to use.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $connection;
|
||||
|
||||
/**
|
||||
* Enables, if supported, wrapping the migration within a transaction.
|
||||
*
|
||||
@ -18,6 +21,13 @@ abstract class Migration
|
||||
*/
|
||||
public $withinTransaction = true;
|
||||
|
||||
/**
|
||||
* The name of the database connection to use.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $connection = 'default';
|
||||
|
||||
/**
|
||||
* Get the migration connection name.
|
||||
*
|
||||
|
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Migrations;
|
||||
|
||||
interface MigrationRepositoryInterface
|
||||
@ -14,7 +24,7 @@ interface MigrationRepositoryInterface
|
||||
/**
|
||||
* Get list of migrations.
|
||||
*
|
||||
* @param int $steps
|
||||
* @param int $steps
|
||||
* @return array
|
||||
*/
|
||||
public function getMigrations($steps);
|
||||
@ -36,17 +46,15 @@ interface MigrationRepositoryInterface
|
||||
/**
|
||||
* Log that a migration was run.
|
||||
*
|
||||
* @param string $file
|
||||
* @param int $batch
|
||||
* @return void
|
||||
* @param string $file
|
||||
* @param int $batch
|
||||
*/
|
||||
public function log($file, $batch);
|
||||
|
||||
/**
|
||||
* Remove a migration from the log.
|
||||
*
|
||||
* @param object $migration
|
||||
* @return void
|
||||
* @param object $migration
|
||||
*/
|
||||
public function delete($migration);
|
||||
|
||||
@ -59,8 +67,6 @@ interface MigrationRepositoryInterface
|
||||
|
||||
/**
|
||||
* Create the migration repository data store.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function createRepository();
|
||||
|
||||
@ -74,8 +80,7 @@ interface MigrationRepositoryInterface
|
||||
/**
|
||||
* Set the information source to gather data.
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
* @param string $name
|
||||
*/
|
||||
public function setSource($name);
|
||||
}
|
||||
|
@ -1,13 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Migrations;
|
||||
|
||||
use Hyperf\Utils\Arr;
|
||||
use Hyperf\Utils\Str;
|
||||
use Hyperf\Utils\Collection;
|
||||
use Hyperf\Console\OutputStyle;
|
||||
use Hyperf\Utils\Filesystem\Filesystem;
|
||||
use Hyperf\Database\Connection;
|
||||
use Hyperf\Database\ConnectionResolverInterface as Resolver;
|
||||
use Hyperf\Database\Schema\Grammars\Grammar;
|
||||
use Hyperf\Utils\Arr;
|
||||
use Hyperf\Utils\Collection;
|
||||
use Hyperf\Utils\Filesystem\Filesystem;
|
||||
use Hyperf\Utils\Str;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Migrator
|
||||
{
|
||||
@ -21,7 +33,7 @@ class Migrator
|
||||
/**
|
||||
* The filesystem instance.
|
||||
*
|
||||
* @var \Hyperf\Filesystem\Filesystem
|
||||
* @var \Hyperf\Utils\Filesystem\Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
@ -49,22 +61,18 @@ class Migrator
|
||||
/**
|
||||
* The output interface implementation.
|
||||
*
|
||||
* @var \Hyperf\Console\OutputStyle
|
||||
* @var OutputInterface
|
||||
*/
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* Create a new migrator instance.
|
||||
*
|
||||
* @param \Hyperf\Database\Migrations\MigrationRepositoryInterface $repository
|
||||
* @param \Hyperf\Database\ConnectionResolverInterface $resolver
|
||||
* @param \Hyperf\Utils\Filesystem\Filesystem $files
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MigrationRepositoryInterface $repository,
|
||||
Resolver $resolver,
|
||||
Filesystem $files)
|
||||
{
|
||||
public function __construct(
|
||||
MigrationRepositoryInterface $repository,
|
||||
Resolver $resolver,
|
||||
Filesystem $files
|
||||
) {
|
||||
$this->files = $files;
|
||||
$this->resolver = $resolver;
|
||||
$this->repository = $repository;
|
||||
@ -73,11 +81,10 @@ class Migrator
|
||||
/**
|
||||
* Run the pending migrations at a given path.
|
||||
*
|
||||
* @param array|string $paths
|
||||
* @param array $options
|
||||
* @return array
|
||||
* @param array|string $paths
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function run($paths = [], array $options = [])
|
||||
public function run($paths = [], array $options = []): array
|
||||
{
|
||||
$this->notes = [];
|
||||
|
||||
@ -87,7 +94,8 @@ class Migrator
|
||||
$files = $this->getMigrationFiles($paths);
|
||||
|
||||
$this->requireFiles($migrations = $this->pendingMigrations(
|
||||
$files, $this->repository->getRan()
|
||||
$files,
|
||||
$this->repository->getRan()
|
||||
));
|
||||
|
||||
// Once we have all these migrations that are outstanding we are ready to run
|
||||
@ -98,29 +106,12 @@ class Migrator
|
||||
return $migrations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the migration files that have not yet run.
|
||||
*
|
||||
* @param array $files
|
||||
* @param array $ran
|
||||
* @return array
|
||||
*/
|
||||
protected function pendingMigrations($files, $ran)
|
||||
{
|
||||
return Collection::make($files)
|
||||
->reject(function ($file) use ($ran) {
|
||||
return in_array($this->getMigrationName($file), $ran);
|
||||
})->values()->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run an array of migrations.
|
||||
*
|
||||
* @param array $migrations
|
||||
* @param array $options
|
||||
* @return void
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function runPending(array $migrations, array $options = [])
|
||||
public function runPending(array $migrations, array $options = []): void
|
||||
{
|
||||
// First we will just make sure that there are any migrations to run. If there
|
||||
// aren't, we will just make a note of it to the developer so they're aware
|
||||
@ -147,52 +138,18 @@ class Migrator
|
||||
$this->runUp($file, $batch, $pretend);
|
||||
|
||||
if ($step) {
|
||||
$batch++;
|
||||
++$batch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run "up" a migration instance.
|
||||
*
|
||||
* @param string $file
|
||||
* @param int $batch
|
||||
* @param bool $pretend
|
||||
* @return void
|
||||
*/
|
||||
protected function runUp($file, $batch, $pretend)
|
||||
{
|
||||
// First we will resolve a "real" instance of the migration class from this
|
||||
// migration file name. Once we have the instances we can run the actual
|
||||
// command such as "up" or "down", or we can just simulate the action.
|
||||
$migration = $this->resolve(
|
||||
$name = $this->getMigrationName($file)
|
||||
);
|
||||
|
||||
if ($pretend) {
|
||||
return $this->pretendToRun($migration, 'up');
|
||||
}
|
||||
|
||||
$this->note("<comment>Migrating:</comment> {$name}");
|
||||
|
||||
$this->runMigration($migration, 'up');
|
||||
|
||||
// Once we have run a migrations class, we will log that it was run in this
|
||||
// repository so that we don't try to run it next time we do a migration
|
||||
// in the application. A migration repository keeps the migrate order.
|
||||
$this->repository->log($name, $batch);
|
||||
|
||||
$this->note("<info>Migrated:</info> {$name}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Rollback the last migration operation.
|
||||
*
|
||||
* @param array|string $paths
|
||||
* @param array $options
|
||||
* @return array
|
||||
* @param array|string $paths
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function rollback($paths = [], array $options = [])
|
||||
public function rollback($paths = [], array $options = []): array
|
||||
{
|
||||
$this->notes = [];
|
||||
|
||||
@ -211,12 +168,202 @@ class Migrator
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the migrations for a rollback operation.
|
||||
* Rolls all of the currently applied migrations back.
|
||||
*
|
||||
* @param array $options
|
||||
* @return array
|
||||
* @param array|string $paths
|
||||
*/
|
||||
protected function getMigrationsForRollback(array $options)
|
||||
public function reset($paths = [], bool $pretend = false): array
|
||||
{
|
||||
$this->notes = [];
|
||||
|
||||
// Next, we will reverse the migration list so we can run them back in the
|
||||
// correct order for resetting this database. This will allow us to get
|
||||
// the database back into its "empty" state ready for the migrations.
|
||||
$migrations = array_reverse($this->repository->getRan());
|
||||
|
||||
if (count($migrations) === 0) {
|
||||
$this->note('<info>Nothing to rollback.</info>');
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->resetMigrations($migrations, $paths, $pretend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a migration instance from a file.
|
||||
*/
|
||||
public function resolve(string $file): object
|
||||
{
|
||||
$class = Str::studly(implode('_', array_slice(explode('_', $file), 4)));
|
||||
|
||||
return new $class();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the migration files in a given path.
|
||||
*
|
||||
* @param array|string $paths
|
||||
*/
|
||||
public function getMigrationFiles($paths): array
|
||||
{
|
||||
return Collection::make($paths)->flatMap(function ($path) {
|
||||
return Str::endsWith($path, '.php') ? [$path] : $this->files->glob($path . '/*_*.php');
|
||||
})->filter()->sortBy(function ($file) {
|
||||
return $this->getMigrationName($file);
|
||||
})->values()->keyBy(function ($file) {
|
||||
return $this->getMigrationName($file);
|
||||
})->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Require in all the migration files in a given path.
|
||||
*/
|
||||
public function requireFiles(array $files): void
|
||||
{
|
||||
foreach ($files as $file) {
|
||||
$this->files->requireOnce($file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the migration.
|
||||
*/
|
||||
public function getMigrationName(string $path): string
|
||||
{
|
||||
return str_replace('.php', '', basename($path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a custom migration path.
|
||||
*/
|
||||
public function path(string $path): void
|
||||
{
|
||||
$this->paths = array_unique(array_merge($this->paths, [$path]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the custom migration paths.
|
||||
*/
|
||||
public function paths(): array
|
||||
{
|
||||
return $this->paths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default connection name.
|
||||
*/
|
||||
public function getConnection(): string
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default connection name.
|
||||
*/
|
||||
public function setConnection(string $name): void
|
||||
{
|
||||
if (! is_null($name)) {
|
||||
$this->resolver->setDefaultConnection($name);
|
||||
}
|
||||
|
||||
$this->repository->setSource($name);
|
||||
|
||||
$this->connection = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the database connection instance.
|
||||
*
|
||||
* @return Connection the return object maybe is a non-extends proxy class, so DONOT define the return type
|
||||
*/
|
||||
public function resolveConnection(string $connection)
|
||||
{
|
||||
return $this->resolver->connection($connection ?: $this->connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the migration repository instance.
|
||||
*/
|
||||
public function getRepository(): MigrationRepositoryInterface
|
||||
{
|
||||
return $this->repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the migration repository exists.
|
||||
*/
|
||||
public function repositoryExists(): bool
|
||||
{
|
||||
return $this->repository->repositoryExists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file system instance.
|
||||
*/
|
||||
public function getFilesystem(): Filesystem
|
||||
{
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the output implementation that should be used by the console.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOutput(OutputInterface $output)
|
||||
{
|
||||
$this->output = $output;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the migration files that have not yet run.
|
||||
*/
|
||||
protected function pendingMigrations(array $files, array $ran): array
|
||||
{
|
||||
return Collection::make($files)
|
||||
->reject(function ($file) use ($ran) {
|
||||
return in_array($this->getMigrationName($file), $ran);
|
||||
})->values()->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run "up" a migration instance.
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
protected function runUp(string $file, int $batch, bool $pretend): void
|
||||
{
|
||||
// First we will resolve a "real" instance of the migration class from this
|
||||
// migration file name. Once we have the instances we can run the actual
|
||||
// command such as "up" or "down", or we can just simulate the action.
|
||||
$migration = $this->resolve(
|
||||
$name = $this->getMigrationName($file)
|
||||
);
|
||||
|
||||
if ($pretend) {
|
||||
$this->pretendToRun($migration, 'up');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->note("<comment>Migrating:</comment> {$name}");
|
||||
|
||||
$this->runMigration($migration, 'up');
|
||||
|
||||
// Once we have run a migrations class, we will log that it was run in this
|
||||
// repository so that we don't try to run it next time we do a migration
|
||||
// in the application. A migration repository keeps the migrate order.
|
||||
$this->repository->log($name, $batch);
|
||||
|
||||
$this->note("<info>Migrated:</info> {$name}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the migrations for a rollback operation.
|
||||
*/
|
||||
protected function getMigrationsForRollback(array $options): array
|
||||
{
|
||||
if (($steps = $options['step'] ?? 0) > 0) {
|
||||
return $this->repository->getMigrations($steps);
|
||||
@ -228,12 +375,10 @@ class Migrator
|
||||
/**
|
||||
* Rollback the given migrations.
|
||||
*
|
||||
* @param array $migrations
|
||||
* @param array|string $paths
|
||||
* @param array $options
|
||||
* @return array
|
||||
* @param array|string $paths
|
||||
* @throws \Throwable
|
||||
*/
|
||||
protected function rollbackMigrations(array $migrations, $paths, array $options)
|
||||
protected function rollbackMigrations(array $migrations, $paths, array $options): array
|
||||
{
|
||||
$rolledBack = [];
|
||||
|
||||
@ -254,7 +399,8 @@ class Migrator
|
||||
$rolledBack[] = $file;
|
||||
|
||||
$this->runDown(
|
||||
$file, $migration,
|
||||
(string) $file,
|
||||
$migration,
|
||||
$options['pretend'] ?? false
|
||||
);
|
||||
}
|
||||
@ -262,40 +408,10 @@ class Migrator
|
||||
return $rolledBack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rolls all of the currently applied migrations back.
|
||||
*
|
||||
* @param array|string $paths
|
||||
* @param bool $pretend
|
||||
* @return array
|
||||
*/
|
||||
public function reset($paths = [], $pretend = false)
|
||||
{
|
||||
$this->notes = [];
|
||||
|
||||
// Next, we will reverse the migration list so we can run them back in the
|
||||
// correct order for resetting this database. This will allow us to get
|
||||
// the database back into its "empty" state ready for the migrations.
|
||||
$migrations = array_reverse($this->repository->getRan());
|
||||
|
||||
if (count($migrations) === 0) {
|
||||
$this->note('<info>Nothing to rollback.</info>');
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->resetMigrations($migrations, $paths, $pretend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the given migrations.
|
||||
*
|
||||
* @param array $migrations
|
||||
* @param array $paths
|
||||
* @param bool $pretend
|
||||
* @return array
|
||||
*/
|
||||
protected function resetMigrations(array $migrations, array $paths, $pretend = false)
|
||||
protected function resetMigrations(array $migrations, array $paths, bool $pretend = false): array
|
||||
{
|
||||
// Since the getRan method that retrieves the migration name just gives us the
|
||||
// migration name, we will format the names into objects with the name as a
|
||||
@ -305,19 +421,18 @@ class Migrator
|
||||
})->all();
|
||||
|
||||
return $this->rollbackMigrations(
|
||||
$migrations, $paths, compact('pretend')
|
||||
$migrations,
|
||||
$paths,
|
||||
compact('pretend')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run "down" a migration instance.
|
||||
*
|
||||
* @param string $file
|
||||
* @param object $migration
|
||||
* @param bool $pretend
|
||||
* @return void
|
||||
* @throws \Throwable
|
||||
*/
|
||||
protected function runDown($file, $migration, $pretend)
|
||||
protected function runDown(string $file, object $migration, bool $pretend): void
|
||||
{
|
||||
// First we will get the file name of the migration so we can resolve out an
|
||||
// instance of the migration. Once we get an instance we can either run a
|
||||
@ -329,7 +444,8 @@ class Migrator
|
||||
$this->note("<comment>Rolling back:</comment> {$name}");
|
||||
|
||||
if ($pretend) {
|
||||
return $this->pretendToRun($instance, 'down');
|
||||
$this->pretendToRun($instance, 'down');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->runMigration($instance, 'down');
|
||||
@ -345,11 +461,9 @@ class Migrator
|
||||
/**
|
||||
* Run a migration inside a transaction if the database supports it.
|
||||
*
|
||||
* @param object $migration
|
||||
* @param string $method
|
||||
* @return void
|
||||
* @throws \Throwable
|
||||
*/
|
||||
protected function runMigration($migration, $method)
|
||||
protected function runMigration(object $migration, string $method): void
|
||||
{
|
||||
$connection = $this->resolveConnection(
|
||||
$migration->getConnection()
|
||||
@ -369,12 +483,8 @@ class Migrator
|
||||
|
||||
/**
|
||||
* Pretend to run the migrations.
|
||||
*
|
||||
* @param object $migration
|
||||
* @param string $method
|
||||
* @return void
|
||||
*/
|
||||
protected function pretendToRun($migration, $method)
|
||||
protected function pretendToRun(object $migration, string $method): void
|
||||
{
|
||||
foreach ($this->getQueries($migration, $method) as $query) {
|
||||
$name = get_class($migration);
|
||||
@ -385,12 +495,8 @@ class Migrator
|
||||
|
||||
/**
|
||||
* Get all of the queries that would be run for a migration.
|
||||
*
|
||||
* @param object $migration
|
||||
* @param string $method
|
||||
* @return array
|
||||
*/
|
||||
protected function getQueries($migration, $method)
|
||||
protected function getQueries(object $migration, string $method): array
|
||||
{
|
||||
// Now that we have the connections we can resolve it and pretend to run the
|
||||
// queries against the database returning the array of raw SQL statements
|
||||
@ -406,126 +512,12 @@ class Migrator
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a migration instance from a file.
|
||||
*
|
||||
* @param string $file
|
||||
* @return object
|
||||
*/
|
||||
public function resolve($file)
|
||||
{
|
||||
$class = Str::studly(implode('_', array_slice(explode('_', $file), 4)));
|
||||
|
||||
return new $class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the migration files in a given path.
|
||||
*
|
||||
* @param string|array $paths
|
||||
* @return array
|
||||
*/
|
||||
public function getMigrationFiles($paths)
|
||||
{
|
||||
return Collection::make($paths)->flatMap(function ($path) {
|
||||
return Str::endsWith($path, '.php') ? [$path] : $this->files->glob($path.'/*_*.php');
|
||||
})->filter()->sortBy(function ($file) {
|
||||
return $this->getMigrationName($file);
|
||||
})->values()->keyBy(function ($file) {
|
||||
return $this->getMigrationName($file);
|
||||
})->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Require in all the migration files in a given path.
|
||||
*
|
||||
* @param array $files
|
||||
* @return void
|
||||
*/
|
||||
public function requireFiles(array $files)
|
||||
{
|
||||
foreach ($files as $file) {
|
||||
$this->files->requireOnce($file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the migration.
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
public function getMigrationName($path)
|
||||
{
|
||||
return str_replace('.php', '', basename($path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a custom migration path.
|
||||
*
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
public function path($path)
|
||||
{
|
||||
$this->paths = array_unique(array_merge($this->paths, [$path]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the custom migration paths.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function paths()
|
||||
{
|
||||
return $this->paths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default connection name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getConnection()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default connection name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function setConnection($name)
|
||||
{
|
||||
if (! is_null($name)) {
|
||||
$this->resolver->setDefaultConnection($name);
|
||||
}
|
||||
|
||||
$this->repository->setSource($name);
|
||||
|
||||
$this->connection = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the database connection instance.
|
||||
*
|
||||
* @param string $connection
|
||||
* @return \Hyperf\Database\Connection
|
||||
*/
|
||||
public function resolveConnection($connection)
|
||||
{
|
||||
return $this->resolver->connection($connection ?: $this->connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the schema grammar out of a migration connection.
|
||||
*
|
||||
* @param \Hyperf\Database\Connection $connection
|
||||
* @return \Hyperf\Database\Schema\Grammars\Grammar
|
||||
* @param Connection $connection the return object maybe is a non-extends proxy class, so DONOT define the return type
|
||||
*/
|
||||
protected function getSchemaGrammar($connection)
|
||||
protected function getSchemaGrammar($connection): Grammar
|
||||
{
|
||||
if (is_null($grammar = $connection->getSchemaGrammar())) {
|
||||
$connection->useDefaultSchemaGrammar();
|
||||
@ -536,54 +528,10 @@ class Migrator
|
||||
return $grammar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the migration repository instance.
|
||||
*
|
||||
* @return \Hyperf\Database\Migrations\MigrationRepositoryInterface
|
||||
*/
|
||||
public function getRepository()
|
||||
{
|
||||
return $this->repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the migration repository exists.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function repositoryExists()
|
||||
{
|
||||
return $this->repository->repositoryExists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file system instance.
|
||||
*
|
||||
* @return \Hyperf\Filesystem\Filesystem
|
||||
*/
|
||||
public function getFilesystem()
|
||||
{
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the output implementation that should be used by the console.
|
||||
*
|
||||
* @param \Hyperf\Console\OutputStyle $output
|
||||
* @return $this
|
||||
*/
|
||||
public function setOutput(OutputStyle $output)
|
||||
{
|
||||
$this->output = $output;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a note to the conosle's output.
|
||||
*
|
||||
* @param string $message
|
||||
* @return void
|
||||
* @param string $message
|
||||
*/
|
||||
protected function note($message)
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\MysqlBuilder as Schema;
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\MysqlBuilder as Schema;
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\MysqlBuilder as Schema;
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
|
@ -29,7 +29,9 @@ use Hyperf\Utils\Traits\ForwardsCalls;
|
||||
*/
|
||||
class Builder
|
||||
{
|
||||
use BuildsQueries, ForwardsCalls, Concerns\QueriesRelationships;
|
||||
use BuildsQueries;
|
||||
use ForwardsCalls;
|
||||
use Concerns\QueriesRelationships;
|
||||
|
||||
/**
|
||||
* The base query builder instance.
|
||||
|
@ -19,7 +19,6 @@ use Hyperf\Database\Model\Events\Creating;
|
||||
use Hyperf\Database\Model\Events\Deleted;
|
||||
use Hyperf\Database\Model\Events\Deleting;
|
||||
use Hyperf\Database\Model\Events\ForceDeleted;
|
||||
use Hyperf\Database\Model\Events\Nothing;
|
||||
use Hyperf\Database\Model\Events\Restored;
|
||||
use Hyperf\Database\Model\Events\Restoring;
|
||||
use Hyperf\Database\Model\Events\Retrieved;
|
||||
|
@ -29,7 +29,13 @@ use Psr\EventDispatcher\StoppableEventInterface;
|
||||
|
||||
abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializable
|
||||
{
|
||||
use Concerns\HasAttributes, Concerns\HasEvents, Concerns\HasGlobalScopes, Concerns\HasRelationships, Concerns\HasTimestamps, Concerns\HidesAttributes, Concerns\GuardsAttributes;
|
||||
use Concerns\HasAttributes;
|
||||
use Concerns\HasEvents;
|
||||
use Concerns\HasGlobalScopes;
|
||||
use Concerns\HasRelationships;
|
||||
use Concerns\HasTimestamps;
|
||||
use Concerns\HidesAttributes;
|
||||
use Concerns\GuardsAttributes;
|
||||
|
||||
/**
|
||||
* The name of the "created at" column.
|
||||
|
@ -2228,7 +2228,7 @@ class Builder
|
||||
|
||||
$wrapped = $this->grammar->wrap($column);
|
||||
|
||||
$columns = array_merge([$column => $this->raw("${wrapped} + ${amount}")], $extra);
|
||||
$columns = array_merge([$column => $this->raw("{$wrapped} + {$amount}")], $extra);
|
||||
|
||||
return $this->update($columns);
|
||||
}
|
||||
@ -2248,7 +2248,7 @@ class Builder
|
||||
|
||||
$wrapped = $this->grammar->wrap($column);
|
||||
|
||||
$columns = array_merge([$column => $this->raw("${wrapped} - ${amount}")], $extra);
|
||||
$columns = array_merge([$column => $this->raw("{$wrapped} - {$amount}")], $extra);
|
||||
|
||||
return $this->update($columns);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ class Grammar extends BaseGrammar
|
||||
return '(' . $this->parameterize($record) . ')';
|
||||
})->implode(', ');
|
||||
|
||||
return "insert into ${table} (${columns}) values ${parameters}";
|
||||
return "insert into {$table} ({$columns}) values {$parameters}";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,7 +163,7 @@ class Grammar extends BaseGrammar
|
||||
*/
|
||||
public function compileInsertUsing(Builder $query, array $columns, string $sql)
|
||||
{
|
||||
return "insert into {$this->wrapTable($query->from)} ({$this->columnize($columns)}) ${sql}";
|
||||
return "insert into {$this->wrapTable($query->from)} ({$this->columnize($columns)}) {$sql}";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -197,7 +197,7 @@ class Grammar extends BaseGrammar
|
||||
// intended records are updated by the SQL statements we generate to run.
|
||||
$wheres = $this->compileWheres($query);
|
||||
|
||||
return trim("update {$table}{$joins} set ${columns} ${wheres}");
|
||||
return trim("update {$table}{$joins} set {$columns} {$wheres}");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -223,7 +223,7 @@ class Grammar extends BaseGrammar
|
||||
{
|
||||
$wheres = is_array($query->wheres) ? $this->compileWheres($query) : '';
|
||||
|
||||
return trim("delete from {$this->wrapTable($query->from)} ${wheres}");
|
||||
return trim("delete from {$this->wrapTable($query->from)} {$wheres}");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -717,7 +717,7 @@ class Grammar extends BaseGrammar
|
||||
{
|
||||
$select = $this->compileSelect($where['query']);
|
||||
|
||||
return $this->wrap($where['column']) . ' ' . $where['operator'] . " (${select})";
|
||||
return $this->wrap($where['column']) . ' ' . $where['operator'] . " ({$select})";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,7 +104,7 @@ class MySqlGrammar extends Grammar
|
||||
// intended records are updated by the SQL statements we generate to run.
|
||||
$where = $this->compileWheres($query);
|
||||
|
||||
$sql = rtrim("update {$table}{$joins} set ${columns} ${where}");
|
||||
$sql = rtrim("update {$table}{$joins} set {$columns} {$where}");
|
||||
|
||||
// If the query has an order by clause we will compile it since MySQL supports
|
||||
// order bys on update statements. We'll compile them using the typical way
|
||||
|
@ -674,7 +674,7 @@ class MySqlGrammar extends Grammar
|
||||
{
|
||||
$columnType = $column->precision ? "datetime({$column->precision})" : 'datetime';
|
||||
|
||||
return $column->useCurrent ? "${columnType} default CURRENT_TIMESTAMP" : $columnType;
|
||||
return $column->useCurrent ? "{$columnType} default CURRENT_TIMESTAMP" : $columnType;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -716,7 +716,7 @@ class MySqlGrammar extends Grammar
|
||||
{
|
||||
$columnType = $column->precision ? "timestamp({$column->precision})" : 'timestamp';
|
||||
|
||||
return $column->useCurrent ? "${columnType} default CURRENT_TIMESTAMP" : $columnType;
|
||||
return $column->useCurrent ? "{$columnType} default CURRENT_TIMESTAMP" : $columnType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
43
src/database/src/Schema/Schema.php
Normal file
43
src/database/src/Schema/Schema.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Database\Schema;
|
||||
|
||||
use Hyperf\Database\ConnectionInterface;
|
||||
use Hyperf\Database\ConnectionResolverInterface;
|
||||
use Hyperf\Utils\ApplicationContext;
|
||||
|
||||
class Schema
|
||||
{
|
||||
public static function __callStatic($name, $arguments)
|
||||
{
|
||||
$container = ApplicationContext::getContainer();
|
||||
$resolver = $container->get(ConnectionResolverInterface::class);
|
||||
$connection = $resolver->connection();
|
||||
return $connection->getSchemaBuilder()->{$name}(...$arguments);
|
||||
}
|
||||
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
return self::__callStatic($name, $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a connection by ConnectionResolver.
|
||||
*/
|
||||
public function connection(string $name = 'default'): ConnectionInterface
|
||||
{
|
||||
$container = ApplicationContext::getContainer();
|
||||
$resolver = $container->get(ConnectionResolverInterface::class);
|
||||
return $resolver->connection($name);
|
||||
}
|
||||
}
|
9
src/db-connection/LICENSE.md
Normal file
9
src/db-connection/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -12,11 +12,19 @@ declare(strict_types=1);
|
||||
|
||||
namespace Hyperf\DbConnection;
|
||||
|
||||
use Hyperf\Database\Commands\Migrations\FreshCommand;
|
||||
use Hyperf\Database\Commands\Migrations\GenMigrateCommand;
|
||||
use Hyperf\Database\Commands\Migrations\InstallCommand;
|
||||
use Hyperf\Database\Commands\Migrations\MigrateCommand;
|
||||
use Hyperf\Database\Commands\Migrations\RefreshCommand;
|
||||
use Hyperf\Database\Commands\Migrations\ResetCommand;
|
||||
use Hyperf\Database\Commands\Migrations\RollbackCommand;
|
||||
use Hyperf\Database\Commands\Migrations\StatusCommand;
|
||||
use Hyperf\Database\Commands\ModelCommand;
|
||||
use Hyperf\Database\ConnectionResolverInterface;
|
||||
use Hyperf\Database\Connectors\ConnectionFactory;
|
||||
use Hyperf\Database\Connectors\MySqlConnector;
|
||||
use Hyperf\Database\Commands\Migrations\GenMigrateCommand;
|
||||
use Hyperf\Database\Migrations\MigrationRepositoryInterface;
|
||||
use Hyperf\DbConnection\Pool\PoolFactory;
|
||||
|
||||
class ConfigProvider
|
||||
@ -29,10 +37,18 @@ class ConfigProvider
|
||||
ConnectionFactory::class => ConnectionFactory::class,
|
||||
ConnectionResolverInterface::class => ConnectionResolver::class,
|
||||
'db.connector.mysql' => MySqlConnector::class,
|
||||
MigrationRepositoryInterface::class => DatabaseMigrationRepositoryFactory::class,
|
||||
],
|
||||
'commands' => [
|
||||
ModelCommand::class,
|
||||
GenMigrateCommand::class,
|
||||
InstallCommand::class,
|
||||
MigrateCommand::class,
|
||||
FreshCommand::class,
|
||||
RefreshCommand::class,
|
||||
ResetCommand::class,
|
||||
RollbackCommand::class,
|
||||
StatusCommand::class,
|
||||
],
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
|
24
src/db-connection/src/DatabaseMigrationRepositoryFactory.php
Normal file
24
src/db-connection/src/DatabaseMigrationRepositoryFactory.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Hyperf\DbConnection;
|
||||
|
||||
|
||||
use Hyperf\Contract\ConfigInterface;
|
||||
use Hyperf\Database\ConnectionResolverInterface;
|
||||
use Hyperf\Database\Migrations\DatabaseMigrationRepository;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class DatabaseMigrationRepositoryFactory
|
||||
{
|
||||
public function __invoke(ContainerInterface $container)
|
||||
{
|
||||
$reslover = $container->get(ConnectionResolverInterface::class);
|
||||
$config = $container->get(ConfigInterface::class);
|
||||
$table = $config->get('databases.migrations', 'migrations');
|
||||
return make(DatabaseMigrationRepository::class, [
|
||||
'resolver' => $reslover,
|
||||
'table' => $table
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
9
src/devtool/LICENSE.md
Normal file
9
src/devtool/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/di/LICENSE.md
Normal file
9
src/di/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/dispatcher/LICENSE.md
Normal file
9
src/dispatcher/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/elasticsearch/LICENSE.md
Normal file
9
src/elasticsearch/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/event/LICENSE.md
Normal file
9
src/event/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/framework/LICENSE.md
Normal file
9
src/framework/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/grpc-client/LICENSE.md
Normal file
9
src/grpc-client/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/grpc-server/LICENSE.md
Normal file
9
src/grpc-server/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/grpc/LICENSE.md
Normal file
9
src/grpc/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/guzzle/LICENSE.md
Normal file
9
src/guzzle/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/http-message/LICENSE.md
Normal file
9
src/http-message/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/http-server/LICENSE.md
Normal file
9
src/http-server/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/json-rpc/LICENSE.md
Normal file
9
src/json-rpc/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/load-balancer/LICENSE.md
Normal file
9
src/load-balancer/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/logger/LICENSE.md
Normal file
9
src/logger/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/memory/LICENSE.md
Normal file
9
src/memory/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/model-cache/LICENSE.md
Normal file
9
src/model-cache/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/paginator/LICENSE.md
Normal file
9
src/paginator/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/pool/LICENSE.md
Normal file
9
src/pool/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/process/LICENSE.md
Normal file
9
src/process/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/rate-limit/LICENSE.md
Normal file
9
src/rate-limit/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/redis/LICENSE.md
Normal file
9
src/redis/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/rpc-client/LICENSE.md
Normal file
9
src/rpc-client/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/rpc-server/LICENSE.md
Normal file
9
src/rpc-server/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/rpc/LICENSE.md
Normal file
9
src/rpc/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/server/LICENSE.md
Normal file
9
src/server/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/service-governance/LICENSE.md
Normal file
9
src/service-governance/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/swagger/LICENSE.md
Normal file
9
src/swagger/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/tracer/LICENSE.md
Normal file
9
src/tracer/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
src/utils/LICENSE.md
Normal file
9
src/utils/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Loading…
Reference in New Issue
Block a user