diff options
author | techknowlogick <techknowlogick@gitea.io> | 2022-08-17 19:25:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-18 02:25:25 +0300 |
commit | d8e6c9912594dfa03d55a021d538b6b0bd0561ee (patch) | |
tree | bebedc28da71c6b284ea8a80b70cccf4d58d13d4 /models/migrations | |
parent | 208b4ee417c528f11583bb84f3f3481bfad12ac7 (diff) | |
download | gitea-d8e6c9912594dfa03d55a021d538b6b0bd0561ee.tar.gz gitea-d8e6c9912594dfa03d55a021d538b6b0bd0561ee.zip |
Add badge capabilities to users (#20607)
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Diffstat (limited to 'models/migrations')
-rw-r--r-- | models/migrations/migrations.go | 3 | ||||
-rw-r--r-- | models/migrations/v999.go | 28 |
2 files changed, 31 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 2719f45efb..aa08f055d3 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -406,6 +406,9 @@ var migrations = []Migration{ NewMigration("Drop old CredentialID column", dropOldCredentialIDColumn), // v223 -> v224 NewMigration("Rename CredentialIDBytes column to CredentialID", renameCredentialIDBytes), + + // v999 + NewMigration("Add badges to users", creatUserBadgesTable), } // GetCurrentDBVersion returns the current db version diff --git a/models/migrations/v999.go b/models/migrations/v999.go new file mode 100644 index 0000000000..d684d538df --- /dev/null +++ b/models/migrations/v999.go @@ -0,0 +1,28 @@ +// Copyright 2022 The Gitea 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 ( + "xorm.io/xorm" +) + +func creatUserBadgesTable(x *xorm.Engine) error { + type Badge struct { + ID int64 `xorm:"pk autoincr"` + Description string + ImageURL string + } + + type userBadge struct { + ID int64 `xorm:"pk autoincr"` + BadgeID int64 + UserID int64 `xorm:"INDEX"` + } + + if err := x.Sync2(new(Badge)); err != nil { + return err + } + return x.Sync2(new(userBadge)) +} |