@@ -274,6 +274,16 @@ public function testAddingUniqueKey()
274
274
$ this ->assertSame ('alter table "users" add constraint "bar" unique ("foo") ' , $ statements [0 ]);
275
275
}
276
276
277
+ public function testAddingUniqueKeyViaUseCreateIndex ()
278
+ {
279
+ $ blueprint = new Blueprint ('users ' );
280
+ $ blueprint ->unique ('foo ' , 'bar ' )->useCreateIndex ();
281
+ $ statements = $ blueprint ->toSql ($ this ->getConnection (), $ this ->getGrammar ());
282
+
283
+ $ this ->assertCount (1 , $ statements );
284
+ $ this ->assertSame ('create unique index "bar" on "users" ("foo") ' , $ statements [0 ]);
285
+ }
286
+
277
287
public function testAddingIndex ()
278
288
{
279
289
$ blueprint = new Blueprint ('users ' );
@@ -364,6 +374,26 @@ public function testAddingRawIndex()
364
374
$ this ->assertSame ('create index "raw_index" on "users" ((function(column))) ' , $ statements [0 ]);
365
375
}
366
376
377
+ public function testAddingRawUniqueKey ()
378
+ {
379
+ $ blueprint = new Blueprint ('users ' );
380
+ $ blueprint ->rawUnique ('foo,bar ' , 'baz ' );
381
+ $ statements = $ blueprint ->toSql ($ this ->getConnection (), $ this ->getGrammar ());
382
+
383
+ $ this ->assertCount (1 , $ statements );
384
+ $ this ->assertSame ('alter table "users" add constraint "baz" unique (foo,bar) ' , $ statements [0 ]);
385
+ }
386
+
387
+ public function testAddingRawUniqueKeyViaUseCreateIndex ()
388
+ {
389
+ $ blueprint = new Blueprint ('users ' );
390
+ $ blueprint ->rawUnique ('function(column) ' , 'baz ' )->useCreateIndex ();
391
+ $ statements = $ blueprint ->toSql ($ this ->getConnection (), $ this ->getGrammar ());
392
+
393
+ $ this ->assertCount (1 , $ statements );
394
+ $ this ->assertSame ('create unique index "baz" on "users" (function(column)) ' , $ statements [0 ]);
395
+ }
396
+
367
397
public function testAddingIncrementingID ()
368
398
{
369
399
$ blueprint = new Blueprint ('users ' );
0 commit comments