File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed
Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1010 ],
1111 "require" : {
1212 "php" : " >=7.1" ,
13- "thecodingmachine/dbal-fluid-schema-builder" : " ^1.4 " ,
13+ "thecodingmachine/dbal-fluid-schema-builder" : " ^1.6 " ,
1414 "doctrine/dbal" : " ^2.5"
1515 },
1616 "require-dev" : {
Original file line number Diff line number Diff line change @@ -51,9 +51,9 @@ public function null(): self
5151 *
5252 * @return self
5353 */
54- public function unique (): self
54+ public function unique (? string $ indexName = null ): self
5555 {
56- $ this ->fluidColumnOptions ->unique ();
56+ $ this ->fluidColumnOptions ->unique ($ indexName );
5757 return $ this ;
5858 }
5959
@@ -62,9 +62,9 @@ public function unique(): self
6262 *
6363 * @return self
6464 */
65- public function index (): self
65+ public function index (? string $ indexName = null ): self
6666 {
67- $ this ->fluidColumnOptions ->index ();
67+ $ this ->fluidColumnOptions ->index ($ indexName );
6868 return $ this ;
6969 }
7070 public function comment (string $ comment ): self
Original file line number Diff line number Diff line change @@ -42,15 +42,15 @@ public function column(string $name): TdbmFluidColumn
4242 return $ this ->tdbmFluidColumns [$ name ];
4343 }
4444
45- public function index (array $ columnNames ): TdbmFluidTable
45+ public function index (array $ columnNames, ? string $ indexName = null ): TdbmFluidTable
4646 {
47- $ this ->fluidTable ->index ($ columnNames );
47+ $ this ->fluidTable ->index ($ columnNames, $ indexName );
4848 return $ this ;
4949 }
5050
51- public function unique (array $ columnNames ): TdbmFluidTable
51+ public function unique (array $ columnNames, ? string $ indexName = null ): TdbmFluidTable
5252 {
53- $ this ->fluidTable ->unique ($ columnNames );
53+ $ this ->fluidTable ->unique ($ columnNames, $ indexName );
5454 return $ this ;
5555 }
5656
Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ public function testOptions()
2626 $ columnOptions ->notNull ();
2727 $ this ->assertSame (true , $ dbalColumn ->getNotnull ());
2828
29- $ columnOptions ->unique ();
30- $ this ->assertSame (true , $ dbalColumn -> getCustomSchemaOption ( ' unique ' ));
29+ $ columnOptions ->unique (' unique_foo ' );
30+ $ this ->assertSame (true , $ posts -> getDbalTable ()-> getIndex ( ' unique_foo ' )-> isUnique ( ));
3131
3232 $ columnOptions ->comment ('foo ' );
3333 $ this ->assertSame ('foo ' , $ dbalColumn ->getComment ());
You can’t perform that action at this time.
0 commit comments