-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add composite index for data migration
- Loading branch information
1 parent
ce839ab
commit 8c5cae2
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/client/java/teammates/client/scripts/sql/IndexCourseFields.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package teammates.client.scripts.sql; | ||
|
||
import com.googlecode.objectify.cmd.Query; | ||
|
||
import teammates.client.scripts.DataMigrationEntitiesBaseScript; | ||
import teammates.storage.entity.Course; | ||
|
||
/** | ||
* Index the newly-indexable fields of courses. | ||
*/ | ||
public class IndexCourseFields extends DataMigrationEntitiesBaseScript<Course> { | ||
|
||
public static void main(String[] args) { | ||
new IndexCourseFields().doOperationRemotely(); | ||
} | ||
|
||
@Override | ||
protected Query<Course> getFilterQuery() { | ||
return ofy().load().type(Course.class); | ||
} | ||
|
||
@Override | ||
protected boolean isPreview() { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected boolean isMigrationNeeded(Course course) { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected void migrateEntity(Course course) { | ||
// Save without any update; this will build the previously non-existing indexes | ||
saveEntityDeferred(course); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters