1
0
Fork 0
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:
Philipp Heckel 2021-12-10 20:28:56 -05:00
parent 06b4d9c83b
commit 5ef83a7ba0
2 changed files with 77 additions and 19 deletions

View file

@ -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