File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
tests/system/Database/Live Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -1372,4 +1372,40 @@ public function testAddTextColumnWithConstraint()
1372
1372
1373
1373
$ this ->assertFalse ($ this ->db ->fieldExists ('text_with_constraint ' , 'user ' ));
1374
1374
}
1375
+
1376
+ public function testDropPrimaryKey ()
1377
+ {
1378
+ $ this ->forge ->dropTable ('forge_test_users ' , true );
1379
+
1380
+ $ this ->forge ->addField ([
1381
+ 'id ' => [
1382
+ 'type ' => 'INTEGER ' ,
1383
+ 'constraint ' => 11 ,
1384
+ ],
1385
+ 'second_id ' => [
1386
+ 'type ' => 'VARCHAR ' ,
1387
+ 'constraint ' => 50 ,
1388
+ ],
1389
+ 'name ' => [
1390
+ 'type ' => 'VARCHAR ' ,
1391
+ 'constraint ' => 255 ,
1392
+ ],
1393
+ ]);
1394
+ $ primaryKeys = ['id ' , 'second_id ' ];
1395
+ $ this ->forge ->addPrimaryKey ($ primaryKeys );
1396
+ $ this ->forge ->createTable ('forge_test_users ' , true );
1397
+
1398
+ $ indexes = $ this ->db ->getIndexData ('forge_test_users ' );
1399
+
1400
+ $ this ->assertCount (1 , $ indexes );
1401
+ $ this ->assertSame ($ primaryKeys , current ($ indexes )->fields );
1402
+
1403
+ $ this ->forge ->dropPrimaryKey ('forge_test_users ' );
1404
+
1405
+ $ indexes = $ this ->db ->getIndexData ('forge_test_users ' );
1406
+
1407
+ $ this ->assertCount (0 , $ indexes );
1408
+
1409
+ $ this ->forge ->dropTable ('forge_test_users ' , true );
1410
+ }
1375
1411
}
You can’t perform that action at this time.
0 commit comments