Skip to content

Commit 7bc7efa

Browse files
committed
Add indexes to scoresLoad fixture tables
1 parent 20e59bf commit 7bc7efa

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/fixtures/scoresLoad.es6

+16
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ var _ = require('lodash')
33
var randomString = require('random-strings')
44
var querySequence = require('../helpers/querySequence')
55

6+
var indexes = {
7+
students: [ ],
8+
assignments: [ 'class_id' ],
9+
scores: [ 'id ASC', 'score DESC', 'assignment_id', 'student_id' ]
10+
}
11+
612
/**
713
* Generate data structure describing a random scores set
814
* @param Integer classCount total number of classes to generate
@@ -86,6 +92,16 @@ exports.install = function(generation) {
8692
_.flatten(rowShard.map(row => _.values(row))) ]
8793
}))
8894

95+
// Related: test/variousQueries.es6 :: applyTableSuffixes
96+
// Suffixes allow concurrent test running
97+
var tablePrefix = table.split('_')[0]
98+
99+
if(indexes[tablePrefix] && indexes[tablePrefix].length !== 0) {
100+
for(let index of indexes[tablePrefix]) {
101+
installQueries.push(`CREATE INDEX ON ${table} (${index})`)
102+
}
103+
}
104+
89105
installQueries.push(`ANALYZE ${table}`)
90106

91107
return querySequence(installQueries)

0 commit comments

Comments
 (0)