mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
Added nocollate indeces
This commit is contained in:
@@ -21,7 +21,7 @@ func SetNotesAndAnnotationsField(fieldlist *core.FieldsList) {
|
||||
}
|
||||
|
||||
func AddMusenalmIDIndex(collection *core.Collection) {
|
||||
AddIndex(collection, MUSENALMID_FIELD, true)
|
||||
AddIndexNoCollate(collection, MUSENALMID_FIELD, true)
|
||||
}
|
||||
|
||||
func AddIndex(collection *core.Collection, field string, unique bool) {
|
||||
@@ -35,6 +35,17 @@ func AddIndex(collection *core.Collection, field string, unique bool) {
|
||||
collection.Indexes = append(collection.Indexes, itext)
|
||||
}
|
||||
|
||||
func AddIndexNoCollate(collection *core.Collection, field string, unique bool) {
|
||||
name := collection.Name
|
||||
iname := "idx_" + name + "_" + field
|
||||
u := ""
|
||||
if unique {
|
||||
u = "UNIQUE "
|
||||
}
|
||||
itext := "CREATE " + u + "INDEX " + iname + " ON " + name + " (" + field + ")"
|
||||
collection.Indexes = append(collection.Indexes, itext)
|
||||
}
|
||||
|
||||
func RelationTableName(collection1, collection2 string) string {
|
||||
return "R_" + collection1 + "_" + collection2
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user