2022-05-22 21:02:06 +02:00
|
|
|
// mautrix-whatsapp - A Matrix-WhatsApp puppeting bridge.
|
|
|
|
// Copyright (C) 2022 Tulir Asokan
|
2022-05-22 00:06:30 +02:00
|
|
|
//
|
2022-05-22 21:02:06 +02:00
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2022-05-22 00:06:30 +02:00
|
|
|
|
2019-05-16 19:14:32 +02:00
|
|
|
package upgrades
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
2022-05-22 00:06:30 +02:00
|
|
|
"embed"
|
2022-01-07 15:45:20 +01:00
|
|
|
"errors"
|
2019-05-16 19:14:32 +02:00
|
|
|
|
2022-05-22 00:06:30 +02:00
|
|
|
"maunium.net/go/mautrix/util/dbutil"
|
2019-05-16 19:14:32 +02:00
|
|
|
)
|
|
|
|
|
2022-05-22 00:06:30 +02:00
|
|
|
var Table dbutil.UpgradeTable
|
2019-05-16 19:14:32 +02:00
|
|
|
|
2022-05-22 00:06:30 +02:00
|
|
|
//go:embed *.sql
|
|
|
|
var rawUpgrades embed.FS
|
2019-05-28 20:29:43 +02:00
|
|
|
|
2022-05-22 00:06:30 +02:00
|
|
|
func init() {
|
2022-05-26 10:23:15 +02:00
|
|
|
Table.Register(-1, 35, "Unsupported version", func(tx *sql.Tx, database *dbutil.Database) error {
|
2022-05-22 00:06:30 +02:00
|
|
|
return errors.New("please upgrade to mautrix-whatsapp v0.4.0 before upgrading to a newer version")
|
|
|
|
})
|
|
|
|
Table.RegisterFS(rawUpgrades)
|
2019-05-16 19:14:32 +02:00
|
|
|
}
|