mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-05 20:44:35 +02:00
Test DB migration
This commit is contained in:
parent
06b4d9c83b
commit
5ef83a7ba0
2 changed files with 77 additions and 19 deletions
server
|
@ -76,9 +76,7 @@ const (
|
|||
|
||||
// 1 -> 2
|
||||
migrate1To2AlterMessagesTableQuery = `
|
||||
BEGIN;
|
||||
ALTER TABLE messages ADD COLUMN published INT NOT NULL DEFAULT(1);
|
||||
COMMIT;
|
||||
`
|
||||
)
|
||||
|
||||
|
@ -220,7 +218,7 @@ func setupDB(db *sql.DB) error {
|
|||
if err != nil {
|
||||
return setupNewDB(db)
|
||||
}
|
||||
defer rowsMC.Close()
|
||||
rowsMC.Close()
|
||||
|
||||
// If 'messages' table exists, check 'schemaVersion' table
|
||||
schemaVersion := 0
|
||||
|
@ -233,6 +231,7 @@ func setupDB(db *sql.DB) error {
|
|||
if err := rowsSV.Scan(&schemaVersion); err != nil {
|
||||
return err
|
||||
}
|
||||
rowsSV.Close()
|
||||
}
|
||||
|
||||
// Do migrations
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue