diff --git a/src/Schema/Blueprint/InlinesIndexes.php b/src/Schema/Blueprint/InlinesIndexes.php index 1e11948..c0f9ac6 100644 --- a/src/Schema/Blueprint/InlinesIndexes.php +++ b/src/Schema/Blueprint/InlinesIndexes.php @@ -122,6 +122,10 @@ public function toSql(Connection $connection, Grammar $grammar) $indexStatementKeys = []; foreach ($this->commands as $command) { + if ($command->shouldBeSkipped) { + continue; + } + $method = 'compile'.ucfirst($command->name); $isIndex = $this->isIndexCommand($command); diff --git a/tests/Hybrid/CreateTable/IncrementWithoutPrimaryKeyTest.php b/tests/Hybrid/CreateTable/IncrementWithoutPrimaryKeyTest.php index 6d858ce..266eb2a 100644 --- a/tests/Hybrid/CreateTable/IncrementWithoutPrimaryKeyTest.php +++ b/tests/Hybrid/CreateTable/IncrementWithoutPrimaryKeyTest.php @@ -2,6 +2,7 @@ namespace SingleStore\Laravel\Tests\Hybrid\CreateTable; +use Illuminate\Foundation\Application; use SingleStore\Laravel\Schema\Blueprint; use SingleStore\Laravel\Tests\BaseTest; use SingleStore\Laravel\Tests\Hybrid\HybridTestHelpers; @@ -20,10 +21,17 @@ public function it_adds_a_big_increments_without_primary_key() $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`))' - ); + if (version_compare(Application::VERSION, '10.38.0', '>=')) { + $this->assertCreateStatement( + $blueprint, + 'create table `test` (`id` bigint unsigned not null auto_increment, `uuid` char(36) not null, primary key (`id`, `uuid`))' + ); + } else { + $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 */ @@ -36,9 +44,16 @@ public function it_adds_an_id_without_primary_key() $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`))' - ); + if (version_compare(Application::VERSION, '10.38.0', '>=')) { + $this->assertCreateStatement( + $blueprint, + 'create table `test` (`id` bigint unsigned not null auto_increment, `uuid` char(36) not null, primary key (`id`, `uuid`))' + ); + } else { + $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`))' + ); + } } } diff --git a/tests/Hybrid/CreateTable/MiscCreateTest.php b/tests/Hybrid/CreateTable/MiscCreateTest.php index a068802..4e69711 100644 --- a/tests/Hybrid/CreateTable/MiscCreateTest.php +++ b/tests/Hybrid/CreateTable/MiscCreateTest.php @@ -2,6 +2,7 @@ namespace SingleStore\Laravel\Tests\Hybrid\CreateTable; +use Illuminate\Foundation\Application; use SingleStore\Laravel\Schema\Blueprint; use SingleStore\Laravel\Tests\BaseTest; use SingleStore\Laravel\Tests\Hybrid\HybridTestHelpers; @@ -20,10 +21,17 @@ public function all_keys_are_added_in_create_columnstore() $table->index('foo', 'name3', 'hash'); }); - $this->assertCreateStatement( - $blueprint, - 'create table `test` (`primary` varchar(255) not null, `index` varchar(255) not null, `foo` varchar(255) not null, index `name3` using hash(`foo`), primary key `name1`(`primary`), index `name2`(`index`))' - ); + if (version_compare(Application::VERSION, '10.38.0', '>=')) { + $this->assertCreateStatement( + $blueprint, + 'create table `test` (`primary` varchar(255) not null, `index` varchar(255) not null, `foo` varchar(255) not null, index `name3` using hash(`foo`), index `name2`(`index`), primary key (`primary`))' + ); + } else { + $this->assertCreateStatement( + $blueprint, + 'create table `test` (`primary` varchar(255) not null, `index` varchar(255) not null, `foo` varchar(255) not null, index `name3` using hash(`foo`), primary key `name1`(`primary`), index `name2`(`index`))' + ); + } } /** @test */ @@ -36,10 +44,17 @@ public function all_keys_are_added_in_create_rowstore() $table->geography('georegion')->spatialIndex('name3'); }); - $this->assertCreateStatement( - $blueprint, - 'create rowstore table `test` (`primary` varchar(255) not null, `index` varchar(255) not null, `georegion` geography not null, primary key `name1`(`primary`), index `name2`(`index`), index `name3`(`georegion`))' - ); + if (version_compare(Application::VERSION, '10.38.0', '>=')) { + $this->assertCreateStatement( + $blueprint, + 'create rowstore table `test` (`primary` varchar(255) not null, `index` varchar(255) not null, `georegion` geography not null, index `name2`(`index`), index `name3`(`georegion`), primary key (`primary`))' + ); + } else { + $this->assertCreateStatement( + $blueprint, + 'create rowstore table `test` (`primary` varchar(255) not null, `index` varchar(255) not null, `georegion` geography not null, primary key `name1`(`primary`), index `name2`(`index`), index `name3`(`georegion`))' + ); + } } /** @test */ @@ -68,10 +83,17 @@ public function discussion_53() $table->timestamps(); }); - $this->assertCreateStatement( - $blueprint, - 'create table `test` (`id` bigint unsigned not null auto_increment, `user_id` bigint unsigned not null, `template_id` varchar(255) not null, `data` longtext not null, `response_status_code` varchar(255) not null, `response_message` longtext not null, `created_at` timestamp null, `updated_at` timestamp null, index `test_id_index`(`id`), shard key(`user_id`))' - ); + if (version_compare(Application::VERSION, '10.38.0', '>=')) { + $this->assertCreateStatement( + $blueprint, + 'create table `test` (`id` bigint unsigned not null auto_increment, `user_id` bigint unsigned not null, `template_id` varchar(255) not null, `data` longtext not null, `response_status_code` varchar(255) not null, `response_message` longtext not null, `created_at` timestamp null, `updated_at` timestamp null, index `test_id_index`(`id`), shard key(`user_id`))' + ); + } else { + $this->assertCreateStatement( + $blueprint, + 'create table `test` (`id` bigint unsigned not null auto_increment, `user_id` bigint unsigned not null, `template_id` varchar(255) not null, `data` longtext not null, `response_status_code` varchar(255) not null, `response_message` longtext not null, `created_at` timestamp null, `updated_at` timestamp null, index `test_id_index`(`id`), shard key(`user_id`))' + ); + } } /** @test */