mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-30 10:47:44 +08:00
Reset recordsModified
to false before conneciont release into pool.
This commit is contained in:
parent
5d0a55d474
commit
41cec1dd96
@ -40,8 +40,6 @@ class InstallCommand extends BaseCommand
|
||||
|
||||
/**
|
||||
* Create a new migration install command instance.
|
||||
*
|
||||
* @param MigrationRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(MigrationRepositoryInterface $repository)
|
||||
{
|
||||
|
@ -38,8 +38,6 @@ class MigrateCommand extends BaseCommand
|
||||
|
||||
/**
|
||||
* Create a new migration command instance.
|
||||
*
|
||||
* @param \Hyperf\Database\Migrations\Migrator $migrator
|
||||
*/
|
||||
public function __construct(Migrator $migrator)
|
||||
{
|
||||
|
@ -74,8 +74,6 @@ class StatusCommand extends BaseCommand
|
||||
/**
|
||||
* Get the status for the given ran migrations.
|
||||
*
|
||||
* @param array $ran
|
||||
* @param array $batches
|
||||
* @return \Hyperf\Utils\Collection
|
||||
*/
|
||||
protected function getStatusFor(array $ran, array $batches)
|
||||
|
@ -28,8 +28,6 @@ class GenSeederCommand extends BaseCommand
|
||||
|
||||
/**
|
||||
* Create a new seeder generator command instance.
|
||||
*
|
||||
* @param \Hyperf\Database\Seeders\SeederCreator $creator
|
||||
*/
|
||||
public function __construct(SeederCreator $creator)
|
||||
{
|
||||
@ -51,8 +49,6 @@ class GenSeederCommand extends BaseCommand
|
||||
|
||||
/**
|
||||
* Write the seeder file to disk.
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
protected function writeMigration(string $name)
|
||||
{
|
||||
|
@ -43,8 +43,6 @@ class SeedCommand extends BaseCommand
|
||||
|
||||
/**
|
||||
* Create a new seed command instance.
|
||||
*
|
||||
* @param \Hyperf\Database\Seeders\Seed $seed
|
||||
*/
|
||||
public function __construct(Seed $seed)
|
||||
{
|
||||
|
@ -537,6 +537,14 @@ class Connection implements ConnectionInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset `recordsModified` to false.
|
||||
*/
|
||||
public function resetRecordsModified(): void
|
||||
{
|
||||
$this->recordsModified = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is Doctrine available?
|
||||
*
|
||||
|
@ -35,8 +35,6 @@ class MigrationCreator
|
||||
|
||||
/**
|
||||
* Create a new migration creator instance.
|
||||
*
|
||||
* @param Filesystem $files
|
||||
*/
|
||||
public function __construct(Filesystem $files)
|
||||
{
|
||||
|
@ -502,8 +502,6 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
||||
|
||||
/**
|
||||
* Save the model to the database.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function save(array $options = []): bool
|
||||
{
|
||||
|
@ -60,9 +60,6 @@ class Seed
|
||||
|
||||
/**
|
||||
* Create a new seed instance.
|
||||
*
|
||||
* @param \Hyperf\Database\ConnectionResolverInterface $resolver
|
||||
* @param \Hyperf\Utils\Filesystem\Filesystem $files
|
||||
*/
|
||||
public function __construct(Resolver $resolver, Filesystem $files)
|
||||
{
|
||||
@ -74,7 +71,6 @@ class Seed
|
||||
* Run the pending seeders at a given path.
|
||||
*
|
||||
* @param array|string $paths
|
||||
* @param array $options
|
||||
* @return array
|
||||
*/
|
||||
public function run($paths = [], array $options = [])
|
||||
@ -90,8 +86,6 @@ class Seed
|
||||
|
||||
/**
|
||||
* Set the default connection name.
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function setConnection(string $name): void
|
||||
{
|
||||
@ -104,9 +98,6 @@ class Seed
|
||||
|
||||
/**
|
||||
* Run an array of seeders.
|
||||
*
|
||||
* @param array $seeders
|
||||
* @param array $options
|
||||
*/
|
||||
public function runSeeders(array $seeders, array $options = [])
|
||||
{
|
||||
@ -155,10 +146,6 @@ class Seed
|
||||
|
||||
/**
|
||||
* Resolve a seeder instance from a file.
|
||||
*
|
||||
* @param string $file
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function resolve(string $file): object
|
||||
{
|
||||
@ -170,8 +157,6 @@ class Seed
|
||||
/**
|
||||
* Resolve the database connection instance.
|
||||
*
|
||||
* @param string $connection
|
||||
*
|
||||
* @return Connection
|
||||
*/
|
||||
public function resolveConnection(string $connection)
|
||||
@ -209,8 +194,6 @@ class Seed
|
||||
|
||||
/**
|
||||
* Require in all the seeder files in a given path.
|
||||
*
|
||||
* @param array $files
|
||||
*/
|
||||
public function requireFiles(array $files)
|
||||
{
|
||||
@ -222,7 +205,6 @@ class Seed
|
||||
/**
|
||||
* Set the output implementation that should be used by the console.
|
||||
*
|
||||
* @param OutputInterface $output
|
||||
* @return $this
|
||||
*/
|
||||
public function setOutput(OutputInterface $output)
|
||||
@ -236,8 +218,6 @@ class Seed
|
||||
* Get the schema grammar out of a migration connection.
|
||||
*
|
||||
* @param Connection $connection
|
||||
*
|
||||
* @return \Hyperf\Database\Schema\Grammars\Grammar
|
||||
*/
|
||||
protected function getSchemaGrammar($connection): Grammar
|
||||
{
|
||||
|
@ -27,8 +27,6 @@ class SeederCreator
|
||||
|
||||
/**
|
||||
* Create a new seeder creator instance.
|
||||
*
|
||||
* @param Filesystem $files
|
||||
*/
|
||||
public function __construct(Filesystem $files)
|
||||
{
|
||||
|
@ -115,10 +115,16 @@ class Connection extends BaseConnection implements ConnectionInterface, DbConnec
|
||||
|
||||
public function release(): void
|
||||
{
|
||||
if ($this->connection instanceof \Hyperf\Database\Connection) {
|
||||
// Reset `recordsModified` to false before conneciont release into pool.
|
||||
$this->connection->resetRecordsModified();
|
||||
}
|
||||
|
||||
if ($this->isTransaction()) {
|
||||
$this->rollBack(0);
|
||||
$this->logger->error('Maybe you\'ve forgotten to commit or rollback the MySQL transaction.');
|
||||
}
|
||||
|
||||
parent::release();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user