mirror of
https://github.com/gogs/gogs.git
synced 2025-05-15 12:00:30 +00:00
* Update repository description field to contain more than 256 symbols - update repository model - description field now is `TEXT` and limited by 4000 symbols - new migration - add description to html forms - repo creation and repo settings - add translation for description * Update for description field, new features - add autosize (height) for description textarea, new plugin - set max description length to 512 symbols - update locales * Fix migration - typo in var * Update repo description behaviour - add textarea autosize for /repo/create - add symbols counter under description testarea (create/edit) * Fix function definition - it a var * Revert ru-RU locale * Update by review - Use type `varchar(512)` in migration - Remove unused files from autosize plugin * Fix migration - new project paths * Fixes after review 2 - copyright year - format includes - use switch instead of multi-if * Remove unused `default:` option.
35 lines
1002 B
Go
35 lines
1002 B
Go
// Copyright 2018 The Gogs Authors. All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package migrations
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/go-xorm/xorm"
|
|
|
|
"github.com/gogs/gogs/pkg/setting"
|
|
)
|
|
|
|
func updateRepositoryDescriptionField(x *xorm.Engine) error {
|
|
exist, err := x.IsTableExist("repository")
|
|
if err != nil {
|
|
return fmt.Errorf("IsTableExist: %v", err)
|
|
} else if !exist {
|
|
return nil
|
|
}
|
|
switch {
|
|
case setting.UseMySQL:
|
|
_, err = x.Exec("ALTER TABLE `repository` MODIFY `description` VARCHAR(512);")
|
|
case setting.UseMSSQL:
|
|
_, err = x.Exec("ALTER TABLE `repository` ALTER COLUMN `description` VARCHAR(512);")
|
|
case setting.UsePostgreSQL:
|
|
_, err = x.Exec("ALTER TABLE `repository` ALTER COLUMN `description` TYPE VARCHAR(512);")
|
|
case setting.UseSQLite3:
|
|
// Sqlite3 uses TEXT type by default for any string type field.
|
|
// Keep this comment to mention that we don't missed any option.
|
|
}
|
|
return err
|
|
}
|