upgrades.go 670 B

123456789101112131415161718192021222324252627
  1. // Copyright (c) 2022 Tulir Asokan
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this
  5. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. package upgrades
  7. import (
  8. "database/sql"
  9. "embed"
  10. "errors"
  11. "maunium.net/go/mautrix/util/dbutil"
  12. )
  13. var Table dbutil.UpgradeTable
  14. //go:embed *.sql
  15. var rawUpgrades embed.FS
  16. func init() {
  17. Table.Register(-1, 43, "Unsupported version", func(tx *sql.Tx, database *dbutil.Database) error {
  18. return errors.New("please upgrade to mautrix-whatsapp v0.4.0 before upgrading to a newer version")
  19. })
  20. Table.RegisterFS(rawUpgrades)
  21. }