mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	* Drop is_bare IDX only when it exists * show indexes only on mysql or mariadb
This commit is contained in:
		@@ -33,9 +33,19 @@ func renameRepoIsBareToIsEmpty(x *xorm.Engine) error {
 | 
				
			|||||||
		_, err = sess.Exec("DROP INDEX IF EXISTS IDX_repository_is_bare")
 | 
							_, err = sess.Exec("DROP INDEX IF EXISTS IDX_repository_is_bare")
 | 
				
			||||||
	} else if models.DbCfg.Type == core.MSSQL {
 | 
						} else if models.DbCfg.Type == core.MSSQL {
 | 
				
			||||||
		_, err = sess.Exec("DROP INDEX IF EXISTS IDX_repository_is_bare ON repository")
 | 
							_, err = sess.Exec("DROP INDEX IF EXISTS IDX_repository_is_bare ON repository")
 | 
				
			||||||
 | 
						} 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 {
 | 
				
			||||||
 | 
								return err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if len(indexes) >= 1 {
 | 
				
			||||||
 | 
								_, err = sess.Exec("DROP INDEX IDX_repository_is_bare ON repository")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		_, err = sess.Exec("DROP INDEX IDX_repository_is_bare ON repository")
 | 
							_, err = sess.Exec("DROP INDEX IDX_repository_is_bare ON repository")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return fmt.Errorf("Drop index failed: %v", err)
 | 
							return fmt.Errorf("Drop index failed: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user