Skip to content

Commit 0c927b1

Browse files
authored
change length of some repository's columns (#7652)
1 parent 31a1fe1 commit 0c927b1

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

models/migrations/migrations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ var migrations = []Migration{
234234
NewMigration("add commit status context field to commit_status", addCommitStatusContext),
235235
// v89 -> v90
236236
NewMigration("add original author/url migration info to issues, comments, and repo ", addOriginalMigrationInfo),
237+
// v90 -> v91
238+
NewMigration("change length of some repository columns", changeSomeColumnsLengthOfRepo),
237239
}
238240

239241
// Migrate database to current version

models/migrations/v90.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2019 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package migrations
6+
7+
import "github.com/go-xorm/xorm"
8+
9+
func changeSomeColumnsLengthOfRepo(x *xorm.Engine) error {
10+
type Repository struct {
11+
ID int64 `xorm:"pk autoincr"`
12+
Description string `xorm:"TEXT"`
13+
Website string `xorm:"VARCHAR(2048)"`
14+
OriginalURL string `xorm:"VARCHAR(2048)"`
15+
}
16+
17+
return x.Sync2(new(Repository))
18+
}

models/repo.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ type Repository struct {
134134
Owner *User `xorm:"-"`
135135
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
136136
Name string `xorm:"INDEX NOT NULL"`
137-
Description string
138-
Website string
139-
OriginalURL string
137+
Description string `xorm:"TEXT"`
138+
Website string `xorm:"VARCHAR(2048)"`
139+
OriginalURL string `xorm:"VARCHAR(2048)"`
140140
DefaultBranch string
141141

142142
NumWatches int

0 commit comments

Comments
 (0)