aboutsummaryrefslogtreecommitdiff
path: root/internal/db/db.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-09-06 17:02:25 +0800
committerGitHub <noreply@github.com>2020-09-06 17:02:25 +0800
commit06193ed825094581da4fb5550804d7445fc5ae13 (patch)
treebd2d966235a224b9d28d316ef915481a63fac5f9 /internal/db/db.go
parent519e59b5778571ace3f681b81a21b92a38ede890 (diff)
schemadoc: add go:generate to output database schema (#6310)
* schemadoc: add go:generate to output database schema * Check errors * Revert string renames
Diffstat (limited to 'internal/db/db.go')
-rw-r--r--internal/db/db.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/db/db.go b/internal/db/db.go
index 03da40ca..ce130f2c 100644
--- a/internal/db/db.go
+++ b/internal/db/db.go
@@ -137,8 +137,10 @@ func openDB(opts conf.DatabaseOpts, cfg *gorm.Config) (*gorm.DB, error) {
return gorm.Open(dialector, cfg)
}
+// Tables is the list of struct-to-table mappings.
+//
// NOTE: Lines are sorted in alphabetical order, each letter in its own line.
-var tables = []interface{}{
+var Tables = []interface{}{
new(AccessToken),
new(LFSObject), new(LoginSource),
}
@@ -196,7 +198,7 @@ func Init() (*gorm.DB, error) {
// NOTE: GORM has problem detecting existing columns, see https://github.com/gogs/gogs/issues/6091.
// Therefore only use it to create new tables, and do customized migration with future changes.
- for _, table := range tables {
+ for _, table := range Tables {
if db.Migrator().HasTable(table) {
continue
}