Add /search endpoint which redirects to user/job

This commit is contained in:
Lou Knauer
2022-02-09 15:03:12 +01:00
parent 0ca7dbb4f1
commit 27fd3c4e5a
4 changed files with 77 additions and 3 deletions

View File

@@ -65,6 +65,12 @@ const JOBS_DB_SCHEMA string = `
FOREIGN KEY (tag_id) REFERENCES tag (id) ON DELETE CASCADE);
`
const JOBS_DB_INDEXES string = `
CREATE INDEX job_by_user ON job (user);
CREATE INDEX job_by_starttime ON job (start_time);
CREATE INDEX job_by_job_id ON job (job_id);
`
// Delete the tables "job", "tag" and "jobtag" from the database and
// repopulate them using the jobs found in `archive`.
func initDB(db *sqlx.DB, archive string) error {
@@ -178,9 +184,7 @@ func initDB(db *sqlx.DB, archive string) error {
// Create indexes after inserts so that they do not
// need to be continually updated.
if _, err := db.Exec(`
CREATE INDEX job_by_user ON job (user);
CREATE INDEX job_by_starttime ON job (start_time);`); err != nil {
if _, err := db.Exec(JOBS_DB_INDEXES); err != nil {
return err
}