timetable-extension #1

Open
fred.boniface wants to merge 160 commits from timetable-extension into main
Showing only changes of commit a2c5bd49ff - Show all commits

View File

@ -154,6 +154,7 @@ func RemoveOutdatedServices(cutoff time.Time) (count int64, err error) {
// Creates indexes on the Timetable collection... Index suitability needs checking.
func CreateTimetableIndexes() error {
log.Info("Creating timetable indexes")
coll := MongoClient.Database(DatabaseName).Collection(TimetableCollection)
indexModels := []mongo.IndexModel{
{
@ -163,22 +164,13 @@ func CreateTimetableIndexes() error {
{Key: "scheduleStartDate", Value: 1},
},
Options: options.Index().SetName("delete_query"),
},
{
Keys: bson.D{
{Key: "trainUid", Value: 1},
{Key: "scheduleStartDate", Value: 1},
{Key: "scheduleEndDate", Value: 1},
{Key: "daysRun", Value: 1},
},
Options: options.Index().SetName("find_by_uid"),
},
}, // The find by UID Query can make use of the delete_query index
{
Keys: bson.D{
{Key: "headcode", Value: 1},
{Key: "daysRun", Value: 1},
{Key: "scheduleStartDate", Value: 1},
{Key: "scheduleEndDate", Value: 1},
{Key: "daysRun", Value: 1},
},
Options: options.Index().SetName("find_by_headcode"),
},