]> source.dussan.org Git - gitea.git/commit
Restore compatibility with SQLServer 2008 R2 in migrations (#16627)
authorzeripath <art27@cantab.net>
Sun, 8 Aug 2021 10:34:24 +0000 (11:34 +0100)
committerGitHub <noreply@github.com>
Sun, 8 Aug 2021 10:34:24 +0000 (13:34 +0300)
commit9c116f2bb51ab3da9385ecdbd538a91c0393e609
treeb504ed521c74baccb034459eb911cf180d0b7cfd
parent07bc380c9f165f9bd199a7d942ef694e572c4387
Restore compatibility with SQLServer 2008 R2 in migrations (#16627)

* Restore compatibility with SQLServer 2008 R2 in migrations

`ALTER TABLE DROP ... IF EXISTS ...` is only supported in SQL Server >16.

The `IF EXISTS` here is a belt-and-braces and does not need to be present. Therefore
can be dropped.

We need to figure out some way of restricting our SQL syntax against the minimum
version of SQL Server we will support.

My suspicion is that `ALTER DATABASE database_name SET COMPATIBILITY_LEVEL = 100` may
do that but there may be other side-effects so I am not whether to do that.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* try just dropping the index only

Signed-off-by: Andrew Thornton <art27@cantab.net>
* use lowercase for system tables

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
models/migrations/migrations.go