migrations

package
v1.14.0-rc8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureUpToDate

func EnsureUpToDate(x *xorm.Engine) error

EnsureUpToDate will check if the db is at the correct version

func ExpectedVersion

func ExpectedVersion() int64

ExpectedVersion returns the expected db version

func GetCurrentDBVersion

func GetCurrentDBVersion(x *xorm.Engine) (int64, error)

GetCurrentDBVersion returns the current db version

func Migrate

func Migrate(x *xorm.Engine) error

Migrate database to current version

func RecreateTables

func RecreateTables(beans ...interface{}) func(*xorm.Engine) error

RecreateTables will recreate the tables for the provided beans using the newly provided bean definition and move all data to that new table WARNING: YOU MUST PROVIDE THE FULL BEAN DEFINITION

Types

type Migration

type Migration interface {
	Description() string
	Migrate(*xorm.Engine) error
}

Migration describes on migration from lower version to high version

func NewMigration

func NewMigration(desc string, fn func(*xorm.Engine) error) Migration

NewMigration creates a new migration

type OAuth2Grant

type OAuth2Grant struct {
	ID            int64  `xorm:"pk autoincr"`
	UserID        int64  `xorm:"INDEX unique(user_application)"`
	ApplicationID int64  `xorm:"INDEX unique(user_application)"`
	Counter       int64  `xorm:"NOT NULL DEFAULT 1"`
	Scope         string `xorm:"TEXT"`
	Nonce         string `xorm:"TEXT"`
	CreatedUnix   int64  `xorm:"created"`
	UpdatedUnix   int64  `xorm:"updated"`
}

OAuth2Grant here is a snapshot of models.OAuth2Grant for this version of the database, as it does not appear to have been added as a part of a previous migration.

func (*OAuth2Grant) TableName

func (grant *OAuth2Grant) TableName() string

TableName sets the database table name to be the correct one, as the autogenerated table name for this struct is "o_auth2_grant".

type RepoWatchMode

type RepoWatchMode int8

RepoWatchMode specifies what kind of watch the user has on a repository

type Version

type Version struct {
	ID      int64 `xorm:"pk autoincr"`
	Version int64
}

Version describes the version table. Should have only one row with id==1

type Watch

type Watch struct {
	ID   int64         `xorm:"pk autoincr"`
	Mode RepoWatchMode `xorm:"SMALLINT NOT NULL DEFAULT 1"`
}

Watch is connection request for receiving repository notification.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL