Skip to content

Commit

Permalink
Added method Hyperf\Database\Schema\Blueprint::engine(). (#7156)
Browse files Browse the repository at this point in the history
  • Loading branch information
People-Sea authored Nov 20, 2024
1 parent 6632bbd commit 8695004
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/Schema/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,22 @@ public function create()
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.
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/MySqlSchemaGrammarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function testEngineCreateTable()
$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');
Expand Down

0 comments on commit 8695004

Please sign in to comment.