Skip to content

Commit

Permalink
Merge joohoi#269 to our fork
Browse files Browse the repository at this point in the history
Co-authored-by: İlteriş Yağıztegin Eroğlu <[email protected]>
Signed-off-by: İlteriş Yağıztegin Eroğlu <[email protected]>
  • Loading branch information
Yannik and linuxgemini committed Feb 9, 2022
1 parent 85f0291 commit eee1c6a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,25 @@ func (d *acmedb) handleDBUpgradeTo1() error {
if Config.Database.Engine != "sqlite3" {
_, _ = tx.Exec("ALTER TABLE records DROP COLUMN IF EXISTS Value")
_, _ = tx.Exec("ALTER TABLE records DROP COLUMN IF EXISTS LastActive")
} else {
_, err = tx.Exec("ALTER TABLE records RENAME TO records_old")
if err != nil {
return err
}
_, err = tx.Exec(userTable)
if err != nil {
return err
}
insertSQL := `INSERT INTO records (Username, Password, Subdomain, AllowFrom)
SELECT Username, Password, Subdomain, AllowFrom FROM records_old`
_, err = tx.Exec(insertSQL)
if err != nil {
return err
}
_, err = tx.Exec("DROP TABLE records_old")
if err != nil {
return err
}
}
_, err = tx.Exec("UPDATE acmedns SET Value='1' WHERE Name='db_version'")
return err
Expand Down

0 comments on commit eee1c6a

Please sign in to comment.