db: schema upgrade 1: add titles.is_deleted column
This commit is contained in:
parent
9aa80bf772
commit
96b5318eca
20
DB.go
20
DB.go
@ -69,9 +69,10 @@ func (this *WikiDB) assertSchema() error {
|
||||
|
||||
log.Printf("Found DB version %d\n", currentSchema)
|
||||
|
||||
// Schema 0 ==> Schema 1
|
||||
//
|
||||
|
||||
if currentSchema == 0 {
|
||||
// Schema 0 ==> Schema 1
|
||||
log.Println("Upgrading to DB version 1")
|
||||
|
||||
err := this.multiTx(
|
||||
@ -96,6 +97,23 @@ func (this *WikiDB) assertSchema() error {
|
||||
currentSchema = 1
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
if currentSchema == 1 {
|
||||
log.Println("Upgrading to DB version 2")
|
||||
|
||||
err := this.multiTx(
|
||||
`ALTER TABLE titles ADD COLUMN is_deleted INTEGER DEFAULT 0;`,
|
||||
`INSERT INTO schema (id) VALUES (2);`,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
currentSchema = 1
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user