31 lines
746 B
Go
31 lines
746 B
Go
package common
|
|
|
|
import (
|
|
"zombiezen.com/go/sqlite"
|
|
"zombiezen.com/go/sqlite/sqlitex"
|
|
)
|
|
|
|
// Represents a note for a bug.
|
|
type BugNote struct {
|
|
ID int64 `db:"id"`
|
|
BugID int32 `db:"bug_id"`
|
|
Note *string `db:"note"`
|
|
Author string `db:"author"`
|
|
NoteDate int32 `db:"note_date"`
|
|
}
|
|
|
|
// Creates the bug notes table if it does not exist.
|
|
func CreateBugNotesTable(conn *sqlite.Conn) error {
|
|
return sqlitex.ExecScript(conn, `
|
|
CREATE TABLE IF NOT EXISTS bug_notes (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
bug_id INTEGER NOT NULL DEFAULT 0,
|
|
note TEXT DEFAULT NULL,
|
|
author TEXT NOT NULL DEFAULT '',
|
|
note_date INTEGER NOT NULL DEFAULT 0
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS BugIDX ON bug_notes(bug_id);
|
|
`)
|
|
}
|