feat: add the quizzes:import command for JSON quiz files
This commit is contained in:
23
updates/20261002121917_add_completed_attempts_index.go
Normal file
23
updates/20261002121917_add_completed_attempts_index.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Code generated by summer make. DO NOT EDIT.
|
||||
|
||||
package updates
|
||||
|
||||
import (
|
||||
"github.com/go-gormigrate/gormigrate/v2"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// AddCompletedAttemptsIndex returns the 20261002121917_add_completed_attempts_index gormigrate entry.
|
||||
// The partial index serves the per-user statistics of the quiz list (count
|
||||
// and best score of completed attempts).
|
||||
func AddCompletedAttemptsIndex() *gormigrate.Migration {
|
||||
return &gormigrate.Migration{
|
||||
ID: "20261002121917_add_completed_attempts_index",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
return tx.Exec("CREATE INDEX golem15_quizzes_attempts_completed_index ON golem15_quizzes_attempts (user_id, quiz_id, score_percent) WHERE completed_at IS NOT NULL").Error
|
||||
},
|
||||
Rollback: func(tx *gorm.DB) error {
|
||||
return tx.Exec("DROP INDEX IF EXISTS golem15_quizzes_attempts_completed_index").Error
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user