-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from srdante/without-primary-key
Add withoutPrimaryKey method for increment columns
- Loading branch information
Showing
3 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
tests/Hybrid/CreateTable/IncrementWithoutPrimaryKeyTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* @author https://github.com/srdante | ||
*/ | ||
|
||
namespace SingleStore\Laravel\Tests\Hybrid\CreateTable; | ||
|
||
use SingleStore\Laravel\Schema\Blueprint; | ||
use SingleStore\Laravel\Tests\BaseTest; | ||
use SingleStore\Laravel\Tests\Hybrid\HybridTestHelpers; | ||
|
||
class IncrementWithoutPrimaryKeyTest extends BaseTest | ||
{ | ||
use HybridTestHelpers; | ||
|
||
/** @test */ | ||
public function it_adds_a_big_increments_without_primary_key() | ||
{ | ||
$blueprint = $this->createTable(function (Blueprint $table) { | ||
$table->bigIncrements('id')->withoutPrimaryKey(); | ||
$table->uuid('uuid'); | ||
|
||
$table->primary(['id', 'uuid']); | ||
}); | ||
|
||
$this->assertCreateStatement( | ||
$blueprint, | ||
'create table `test` (`id` bigint unsigned not null auto_increment, `uuid` char(36) not null, primary key `test_id_uuid_primary`(`id`, `uuid`))' | ||
); | ||
} | ||
|
||
/** @test */ | ||
public function it_adds_an_id_without_primary_key() | ||
{ | ||
$blueprint = $this->createTable(function (Blueprint $table) { | ||
$table->id()->withoutPrimaryKey(); | ||
$table->uuid('uuid'); | ||
|
||
$table->primary(['id', 'uuid']); | ||
}); | ||
|
||
$this->assertCreateStatement( | ||
$blueprint, | ||
'create table `test` (`id` bigint unsigned not null auto_increment, `uuid` char(36) not null, primary key `test_id_uuid_primary`(`id`, `uuid`))' | ||
); | ||
} | ||
} |