Skip to content

Commit

Permalink
Add charset and collection method to Blueprint
Browse files Browse the repository at this point in the history
  • Loading branch information
gcazin committed Dec 15, 2023
1 parent 59f184e commit ad17f86
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions src/Illuminate/Database/Schema/Blueprint.php
Expand Up @@ -291,6 +291,28 @@ public function create()
return $this->addCommand('create');
}

/**
* Specify the charset that should be used for the table.
*
* @param string $charset
* @return void
*/
public function charset($charset)
{
$this->charset = $charset;
}

/**
* Specify the collation that should be used for the table.
*
* @param string $collation
* @return void
*/
public function collation($collation)
{
$this->collation = $collation;
}

/**
* Specify the storage engine that should be used for the table.
*
Expand Down
4 changes: 2 additions & 2 deletions tests/Database/DatabaseMySqlSchemaGrammarTest.php
Expand Up @@ -131,8 +131,8 @@ public function testCharsetCollationCreateTable()
$blueprint->create();
$blueprint->increments('id');
$blueprint->string('email');
$blueprint->charset = 'utf8mb4';
$blueprint->collation = 'utf8mb4_unicode_ci';
$blueprint->charset('utf8mb4');
$blueprint->collation('utf8mb4_unicode_ci');

$conn = $this->getConnection();
$conn->shouldReceive('getConfig')->once()->with('engine')->andReturn(null);
Expand Down

0 comments on commit ad17f86

Please sign in to comment.