mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-23 10:35:04 +08:00
parent
a2a006a5d5
commit
d1a32fa108
|
@ -32,7 +32,14 @@ func renameRepoIsBareToIsEmpty(x *xorm.Engine) error {
|
|||
if models.DbCfg.Type == core.POSTGRES || models.DbCfg.Type == core.SQLITE {
|
||||
_, err = sess.Exec("DROP INDEX IF EXISTS IDX_repository_is_bare")
|
||||
} else if models.DbCfg.Type == core.MSSQL {
|
||||
_, err = sess.Exec("DROP INDEX IF EXISTS IDX_repository_is_bare ON repository")
|
||||
_, err = sess.Exec(`DECLARE @ConstraintName VARCHAR(256)
|
||||
DECLARE @SQL NVARCHAR(256)
|
||||
SELECT @ConstraintName = obj.name FROM sys.columns col LEFT OUTER JOIN sys.objects obj ON obj.object_id = col.default_object_id AND obj.type = 'D' WHERE col.object_id = OBJECT_ID('repository') AND obj.name IS NOT NULL AND col.name = 'is_bare'
|
||||
SET @SQL = N'ALTER TABLE [repository] DROP CONSTRAINT [' + @ConstraintName + N']'
|
||||
EXEC sp_executesql @SQL`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else if models.DbCfg.Type == core.MYSQL {
|
||||
indexes, err := sess.QueryString(`SHOW INDEX FROM repository WHERE KEY_NAME = 'IDX_repository_is_bare'`)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user