storage: add indexes for postgres

This commit is contained in:
Caleb Doxsey 2023-08-21 14:03:15 -06:00
parent 379abecab1
commit 6f79db5dfd

View file

@ -139,6 +139,22 @@ var migrations = []func(context.Context, pgx.Tx) error{
return err
}
return nil
},
5: func(ctx context.Context, tx pgx.Tx) error {
for _, q := range []string{
`CREATE INDEX ON ` + schemaName + `.` + recordsTableName + ` (type)`,
`CREATE INDEX ON ` + schemaName + `.` + recordsTableName + ` (id)`,
`CREATE INDEX ON ` + schemaName + `.` + recordChangesTableName + ` (modified_at)`,
`CREATE INDEX ON ` + schemaName + `.` + recordChangesTableName + ` (version)`,
`CREATE INDEX ON ` + schemaName + `.` + recordChangesTableName + ` (type)`,
} {
_, err := tx.Exec(ctx, q)
if err != nil {
return err
}
}
return nil
},
}