aboutsummaryrefslogtreecommitdiffstats
path: root/models/migrations/v1_18/v224.go
blob: f37b773effa19258a58686e453abe8e1342cc510 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package v1_18 // nolint

import (
	"xorm.io/xorm"
)

func CreateUserBadgesTable(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))
}