@@ -156,6 +156,42 @@ public function testDropColumnMaintainsKeys()
156156 $ this ->assertTrue ($ result );
157157 }
158158
159+ public function testDropColumnDropCompositeKey ()
160+ {
161+ $ this ->forge ->dropTable ('actions ' , true );
162+
163+ $ fields = [
164+ 'category ' => ['type ' => 'varchar ' , 'constraint ' => 63 ],
165+ 'name ' => ['type ' => 'varchar ' , 'constraint ' => 63 ],
166+ 'created_at ' => ['type ' => 'datetime ' , 'null ' => true ],
167+ ];
168+
169+ $ this ->forge ->addField ('id ' );
170+ $ this ->forge ->addField ($ fields );
171+
172+ $ this ->forge ->addKey ('name ' );
173+ $ this ->forge ->addKey (['category ' , 'name ' ]);
174+ $ this ->forge ->addKey ('created_at ' );
175+
176+ $ this ->forge ->createTable ('actions ' );
177+
178+ $ indexes = $ this ->db ->getIndexData ('actions ' );
179+
180+ // the composite index was created
181+ $ this ->assertSame (['category ' , 'name ' ], $ indexes ['actions_category_name ' ]->fields );
182+
183+ // drop one of the columns in the composite index
184+ $ this ->forge ->dropColumn ('actions ' , 'category ' );
185+
186+ // get indexes again
187+ $ indexes = $ this ->db ->getIndexData ('actions ' );
188+
189+ // check that composite index was dropped.
190+ $ this ->assertFalse (isset ($ indexes ['actions_category_name ' ]));
191+
192+ $ this ->forge ->dropTable ('actions ' );
193+ }
194+
159195 public function testModifyColumnSuccess ()
160196 {
161197 $ this ->createTable ('janky ' );
0 commit comments