File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33var Node = require ( __dirname ) ;
44var IndexesNode = module . exports = Node . define ( {
55 type : 'INDEXES' ,
6- constructor : function ( ) {
6+
7+ constructor : function ( table ) {
78 Node . call ( this ) ;
8- this . names = [ ] ;
9- this . columns = [ ] ;
9+ this . table = table ;
10+ this . names = [ ] ;
11+ this . columns = [ ] ;
1012 this . valueSets = [ ] ;
1113 }
1214} ) ;
Original file line number Diff line number Diff line change @@ -229,7 +229,8 @@ var Query = Node.define({
229229 return this ;
230230 } ,
231231 indexes : function ( ) {
232- this . add ( new Indexes ( ) ) ;
232+ var indexes = new Indexes ( { table : this . table } ) ;
233+ this . add ( indexes ) ;
233234 return this ;
234235 }
235236} ) ;
Original file line number Diff line number Diff line change @@ -210,6 +210,6 @@ Table.prototype.indexes = function() {
210210 var query = new Query ( this ) ;
211211 query . indexes . apply ( query , arguments ) ;
212212 return query ;
213- }
213+ } ;
214214
215215module . exports = Table ;
Original file line number Diff line number Diff line change @@ -9,3 +9,14 @@ Harness.test({
99 mysql : "SHOW INDEX FROM `post`" ,
1010 sqlite : "PRAGMA INDEX_LIST(\"post\")"
1111} ) ;
12+
13+ Harness . test ( {
14+ query : post . indexes ( ) . create ( {
15+ type : 'unique' ,
16+ algorithm : 'btree' ,
17+ parser : 'foo' ,
18+ name : 'bar' ,
19+ columns : [ post . id , post . userId ]
20+ } ) ,
21+ mysql : "CREATE UNIQUE INDEX `bar` USING BTREE ON `post` (`post`.`id`, `post`.`userId`) WITH PARSER foo"
22+ } )
You can’t perform that action at this time.
0 commit comments