Added method Hyperf\Database\Schema\Blueprint::engine(). (#7156)

This commit is contained in:
WenRenHai 2024-11-20 14:07:44 +08:00 committed by GitHub
parent d4aa1c2087
commit b332642bd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 1 deletions

View File

@ -4,6 +4,7 @@
- [#7148](https://github.com/hyperf/hyperf/pull/7148) Added `exclude` rules for `hyperf/validation`.
- [#7150](https://github.com/hyperf/hyperf/pull/7150) Added missing methods (`accepted_if`, `ascii`, `date_equals`...) to validation messages.
- [#7156](https://github.com/hyperf/hyperf/pull/7156) Added method `Hyperf\Database\Schema\Blueprint::engine()`.
# v3.1.45 - 2024-11-14

View File

@ -198,6 +198,22 @@ class Blueprint
return $this->addCommand('create');
}
/**
* Specify the storage engine that should be used for the table.
*/
public function engine(string $engine): void
{
$this->engine = $engine;
}
/**
* Specify that the InnoDB storage engine should be used for the table (MySQL only).
*/
public function innoDb(): void
{
$this->engine('InnoDB');
}
/**
* Set the table comment.
*/

View File

@ -158,7 +158,7 @@ class MySqlSchemaGrammarTest extends TestCase
$blueprint->create();
$blueprint->increments('id');
$blueprint->string('email');
$blueprint->engine = 'InnoDB';
$blueprint->engine('InnoDB');
$conn = $this->getConnection();
$conn->shouldReceive('getConfig')->once()->with('charset')->andReturn('utf8');