forgejo-federation/services/forgejo/sanity.go

27 lines
580 B
Go
Raw Normal View History

[UPGRADE] run sanity checks before the database is upgraded (cherry picked from commit 69741e4e66932a9ac092089e7ba27399c55dcd1a) (cherry picked from commit 2a3c7b09cbdfd62cca2619aaf37b6913a373d142) (cherry picked from commit a1554c1168d897e8db4024d716a837c012bf74e9) (cherry picked from commit edae2c6d2dda7f44e40ae88fba60a15f61b72232) (cherry picked from commit 49737cf009a6a0fc119cf8a1a1593493c77c841a) (cherry picked from commit ec53704c34a3e9491b4f210250d5e053f4b221e5) (cherry picked from commit 7a1c5c0f323cb5e9235d8fa6e59a0a1b172d3abb) (cherry picked from commit e658c20c0f21b42f741c0149e0e79ea0bb3b949c) (cherry picked from commit baf575468f39c5dd0c2ff3498ef9f706d12d114e) (cherry picked from commit 40cb14eff427c801243e374f7c60fef994bcb792) (cherry picked from commit 25ab4d07136d023236de00e9143957c856b4d196) (cherry picked from commit 5a29005215a5e9419ed3096c1bc0aae172f45089) (cherry picked from commit fef1260e990719af49644970aaa2a7219438b681) (cherry picked from commit eadbbb1afe6f36cfaf4cc3fc346b510893f21011) (cherry picked from commit db22d61eb47b56cc7cf0f44934f8f550df029e76) (cherry picked from commit 9d3b0be39a008e2e1a4f474b0ab74627e003430d) (cherry picked from commit b3fa3c1292228ef4833b6ea1f120102471478256) (cherry picked from commit c8300d4fe24fccaefc18e95ec8c6d689f1cb4d7a) (cherry picked from commit 8ba6a4c9dbd9cbb2758b02016f1858d1e85633ce) (cherry picked from commit 8b8df652c1eb7806e590751942b4689e374e1128) (cherry picked from commit fc8fa050c688451c9c2079b1f0f71ed11a6d7e4d) (cherry picked from commit bcf3faf69843421517bf3ddf032fe92cbf0a766d) (cherry picked from commit 514a631aa650987ef3400ad31eb32af676a97164) (cherry picked from commit 529c7a09f73bdb27ac14e0cdb6312eac2bc1109c) (cherry picked from commit 0d093d76e2d27523f42606d78c1302057c328913)
2023-08-09 03:35:06 +05:30
// SPDX-License-Identifier: MIT
package forgejo
import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
)
var (
[UPGRADE] add sanity checks for [storage*] Refs: https://forgejo.org/2023-08-release-v1-20-3-0/ (cherry picked from commit a266dd0ce3fca1296c6713ff1266f0065f0cd72b) (cherry picked from commit b9eb5eccd83e73ab6fb392557b7036063244f357) (cherry picked from commit 7fc2028ede6e3a576c3714b27940de9f871c33bd) (cherry picked from commit 0c988e612028eab277f03c16c0597da08c2c293a) (cherry picked from commit 7ba05e8c2b51c4c08ab3885f9014f7bdaf3d0f6b) (cherry picked from commit 2ed5068abe0cb57a257167d669faee207762b1d0) (cherry picked from commit 353913a26dd749f017cf8b76cf9218f68e8ca408) (cherry picked from commit 4e63a01a8bf9d0c8a1a6a6d7a3b18c64369bbaf1) (cherry picked from commit 99f612aed30852b23fe325bd5b6095aee9bd558e) (cherry picked from commit b4fe189caea9c656edd9c0c20e0d667911e4921c) (cherry picked from commit bd35e3b7bc2d64e649915c5103067be1c7ffbe44) (cherry picked from commit f59d9f7088af9963041eedc46fcce2ec8c9c4722) (cherry picked from commit 0b2a93e044b1d9319345ed2b6104a479eae376ef) (cherry picked from commit 8c5d8bfea0d65ebab33e2cb7dd04298d0f263fdd) (cherry picked from commit 2817ce027cbcd630d83484c98b9539a3a94a5266) (cherry picked from commit 162056cbcfd79710e4d81b1b36f650be291df832) (cherry picked from commit 07152a0ba640f71fa669ef84c473eb773a15ede9) (cherry picked from commit 72e37779159a1820bb2d02b4647967fed3c8abc2) (cherry picked from commit 3b1ebd95b94327b8056eed51e9c6dbb4c412af09) (cherry picked from commit 14fc4f3fac637fb026a64b6110026533caa11dfc) (cherry picked from commit 9052c86e8ce97895eec8642bdb1c987790924b03) (cherry picked from commit 16f1cc21ea518c5390061534c8cfcc8f9f0c2587) (cherry picked from commit 0fef12f5d85870fa364d6046ac04dcdfc8cb69df) (cherry picked from commit d187381f73a0859198aade34057c63aef38d764d) (cherry picked from commit 9dda7151116af3a0d52b0778eff0f837d6bd1cf5)
2023-08-09 03:36:25 +05:30
ForgejoV6DatabaseVersion = int64(261) // must be updated once v6 / Gitea v1.21 is out
[UPGRADE] run sanity checks before the database is upgraded (cherry picked from commit 69741e4e66932a9ac092089e7ba27399c55dcd1a) (cherry picked from commit 2a3c7b09cbdfd62cca2619aaf37b6913a373d142) (cherry picked from commit a1554c1168d897e8db4024d716a837c012bf74e9) (cherry picked from commit edae2c6d2dda7f44e40ae88fba60a15f61b72232) (cherry picked from commit 49737cf009a6a0fc119cf8a1a1593493c77c841a) (cherry picked from commit ec53704c34a3e9491b4f210250d5e053f4b221e5) (cherry picked from commit 7a1c5c0f323cb5e9235d8fa6e59a0a1b172d3abb) (cherry picked from commit e658c20c0f21b42f741c0149e0e79ea0bb3b949c) (cherry picked from commit baf575468f39c5dd0c2ff3498ef9f706d12d114e) (cherry picked from commit 40cb14eff427c801243e374f7c60fef994bcb792) (cherry picked from commit 25ab4d07136d023236de00e9143957c856b4d196) (cherry picked from commit 5a29005215a5e9419ed3096c1bc0aae172f45089) (cherry picked from commit fef1260e990719af49644970aaa2a7219438b681) (cherry picked from commit eadbbb1afe6f36cfaf4cc3fc346b510893f21011) (cherry picked from commit db22d61eb47b56cc7cf0f44934f8f550df029e76) (cherry picked from commit 9d3b0be39a008e2e1a4f474b0ab74627e003430d) (cherry picked from commit b3fa3c1292228ef4833b6ea1f120102471478256) (cherry picked from commit c8300d4fe24fccaefc18e95ec8c6d689f1cb4d7a) (cherry picked from commit 8ba6a4c9dbd9cbb2758b02016f1858d1e85633ce) (cherry picked from commit 8b8df652c1eb7806e590751942b4689e374e1128) (cherry picked from commit fc8fa050c688451c9c2079b1f0f71ed11a6d7e4d) (cherry picked from commit bcf3faf69843421517bf3ddf032fe92cbf0a766d) (cherry picked from commit 514a631aa650987ef3400ad31eb32af676a97164) (cherry picked from commit 529c7a09f73bdb27ac14e0cdb6312eac2bc1109c) (cherry picked from commit 0d093d76e2d27523f42606d78c1302057c328913)
2023-08-09 03:35:06 +05:30
ForgejoV5DatabaseVersion = int64(260)
ForgejoV4DatabaseVersion = int64(244)
)
var logFatal = log.Fatal
func fatal(err error) error {
logFatal("%v", err)
return err
}
func PreMigrationSanityChecks(e db.Engine, dbVersion int64, cfg setting.ConfigProvider) error {
[UPGRADE] add sanity checks for [storage*] Refs: https://forgejo.org/2023-08-release-v1-20-3-0/ (cherry picked from commit a266dd0ce3fca1296c6713ff1266f0065f0cd72b) (cherry picked from commit b9eb5eccd83e73ab6fb392557b7036063244f357) (cherry picked from commit 7fc2028ede6e3a576c3714b27940de9f871c33bd) (cherry picked from commit 0c988e612028eab277f03c16c0597da08c2c293a) (cherry picked from commit 7ba05e8c2b51c4c08ab3885f9014f7bdaf3d0f6b) (cherry picked from commit 2ed5068abe0cb57a257167d669faee207762b1d0) (cherry picked from commit 353913a26dd749f017cf8b76cf9218f68e8ca408) (cherry picked from commit 4e63a01a8bf9d0c8a1a6a6d7a3b18c64369bbaf1) (cherry picked from commit 99f612aed30852b23fe325bd5b6095aee9bd558e) (cherry picked from commit b4fe189caea9c656edd9c0c20e0d667911e4921c) (cherry picked from commit bd35e3b7bc2d64e649915c5103067be1c7ffbe44) (cherry picked from commit f59d9f7088af9963041eedc46fcce2ec8c9c4722) (cherry picked from commit 0b2a93e044b1d9319345ed2b6104a479eae376ef) (cherry picked from commit 8c5d8bfea0d65ebab33e2cb7dd04298d0f263fdd) (cherry picked from commit 2817ce027cbcd630d83484c98b9539a3a94a5266) (cherry picked from commit 162056cbcfd79710e4d81b1b36f650be291df832) (cherry picked from commit 07152a0ba640f71fa669ef84c473eb773a15ede9) (cherry picked from commit 72e37779159a1820bb2d02b4647967fed3c8abc2) (cherry picked from commit 3b1ebd95b94327b8056eed51e9c6dbb4c412af09) (cherry picked from commit 14fc4f3fac637fb026a64b6110026533caa11dfc) (cherry picked from commit 9052c86e8ce97895eec8642bdb1c987790924b03) (cherry picked from commit 16f1cc21ea518c5390061534c8cfcc8f9f0c2587) (cherry picked from commit 0fef12f5d85870fa364d6046ac04dcdfc8cb69df) (cherry picked from commit d187381f73a0859198aade34057c63aef38d764d) (cherry picked from commit 9dda7151116af3a0d52b0778eff0f837d6bd1cf5)
2023-08-09 03:36:25 +05:30
return v1TOv5_0_1Included(e, dbVersion, cfg)
[UPGRADE] run sanity checks before the database is upgraded (cherry picked from commit 69741e4e66932a9ac092089e7ba27399c55dcd1a) (cherry picked from commit 2a3c7b09cbdfd62cca2619aaf37b6913a373d142) (cherry picked from commit a1554c1168d897e8db4024d716a837c012bf74e9) (cherry picked from commit edae2c6d2dda7f44e40ae88fba60a15f61b72232) (cherry picked from commit 49737cf009a6a0fc119cf8a1a1593493c77c841a) (cherry picked from commit ec53704c34a3e9491b4f210250d5e053f4b221e5) (cherry picked from commit 7a1c5c0f323cb5e9235d8fa6e59a0a1b172d3abb) (cherry picked from commit e658c20c0f21b42f741c0149e0e79ea0bb3b949c) (cherry picked from commit baf575468f39c5dd0c2ff3498ef9f706d12d114e) (cherry picked from commit 40cb14eff427c801243e374f7c60fef994bcb792) (cherry picked from commit 25ab4d07136d023236de00e9143957c856b4d196) (cherry picked from commit 5a29005215a5e9419ed3096c1bc0aae172f45089) (cherry picked from commit fef1260e990719af49644970aaa2a7219438b681) (cherry picked from commit eadbbb1afe6f36cfaf4cc3fc346b510893f21011) (cherry picked from commit db22d61eb47b56cc7cf0f44934f8f550df029e76) (cherry picked from commit 9d3b0be39a008e2e1a4f474b0ab74627e003430d) (cherry picked from commit b3fa3c1292228ef4833b6ea1f120102471478256) (cherry picked from commit c8300d4fe24fccaefc18e95ec8c6d689f1cb4d7a) (cherry picked from commit 8ba6a4c9dbd9cbb2758b02016f1858d1e85633ce) (cherry picked from commit 8b8df652c1eb7806e590751942b4689e374e1128) (cherry picked from commit fc8fa050c688451c9c2079b1f0f71ed11a6d7e4d) (cherry picked from commit bcf3faf69843421517bf3ddf032fe92cbf0a766d) (cherry picked from commit 514a631aa650987ef3400ad31eb32af676a97164) (cherry picked from commit 529c7a09f73bdb27ac14e0cdb6312eac2bc1109c) (cherry picked from commit 0d093d76e2d27523f42606d78c1302057c328913)
2023-08-09 03:35:06 +05:30
}