@@ -64,7 +64,7 @@ public function testJointureTableDetectionWith3Columns() {
64
64
$ schema = $ this ->getBaseSchema ();
65
65
66
66
$ role_right = $ schema ->createTable ("role_right " );
67
- $ role_right ->addColumn ("id " , "integer " , array ("unsigned " => true ));
67
+ $ role_right ->addColumn ("id " , "integer " , array ("unsigned " => true , " autoincrement " => true ));
68
68
$ role_right ->addColumn ("role_id " , "integer " , array ("unsigned " => true ));
69
69
$ role_right ->addColumn ("right_id " , "integer " , array ("unsigned " => true ));
70
70
@@ -82,11 +82,29 @@ public function testJointureTableDetectionWith3Columns() {
82
82
}
83
83
}
84
84
85
+ public function testJointureTableDetectionWith3ColumnsNoAutoincrement () {
86
+ $ schema = $ this ->getBaseSchema ();
87
+
88
+ $ role_right = $ schema ->createTable ("role_right " );
89
+ $ role_right ->addColumn ("id " , "integer " , array ("unsigned " => true , "autoincrement " => false ));
90
+ $ role_right ->addColumn ("role_id " , "integer " , array ("unsigned " => true ));
91
+ $ role_right ->addColumn ("right_id " , "integer " , array ("unsigned " => true ));
92
+
93
+ $ role_right ->addForeignKeyConstraint ($ schema ->getTable ('role ' ), array ("role_id " ), array ("id " ), array ("onUpdate " => "CASCADE " ));
94
+ $ role_right ->addForeignKeyConstraint ($ schema ->getTable ('right ' ), array ("right_id " ), array ("id " ), array ("onUpdate " => "CASCADE " ));
95
+ $ role_right ->setPrimaryKey (["id " ]);
96
+
97
+ $ schemaAnalyzer = new SchemaAnalyzer ($ schema );
98
+ $ junctionTables = $ schemaAnalyzer ->detectJunctionTables ();
99
+
100
+ $ this ->assertCount (0 , $ junctionTables );
101
+ }
102
+
85
103
public function testJointureTableDetectionWith4Columns () {
86
104
$ schema = $ this ->getBaseSchema ();
87
105
88
106
$ role_right = $ schema ->createTable ("role_right " );
89
- $ role_right ->addColumn ("id " , "integer " , array ("unsigned " => true ));
107
+ $ role_right ->addColumn ("id " , "integer " , array ("unsigned " => true , " autoincrement " => true ));
90
108
$ role_right ->addColumn ("role_id " , "integer " , array ("unsigned " => true ));
91
109
$ role_right ->addColumn ("right_id " , "integer " , array ("unsigned " => true ));
92
110
$ role_right ->addColumn ("label " , "string " , array ("length " => 32 ));
@@ -140,7 +158,7 @@ public function testJointureTableDetectionWith3ColumnsWithPkIsFk() {
140
158
$ schema = $ this ->getBaseSchema ();
141
159
142
160
$ role_right = $ schema ->createTable ("role_right " );
143
- $ role_right ->addColumn ("id " , "integer " , array ("unsigned " => true ));
161
+ $ role_right ->addColumn ("id " , "integer " , array ("unsigned " => true , " autoincrement " => true ));
144
162
$ role_right ->addColumn ("role_id " , "integer " , array ("unsigned " => true ));
145
163
$ role_right ->addColumn ("right_id " , "integer " , array ("unsigned " => true ));
146
164
0 commit comments