migrations

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectedVersion

func ExpectedVersion() int64

ExpectedVersion returns the expected db version

func GetCurrentDBVersion

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

GetCurrentDBVersion returns the current db version

func InitDB

func InitDB(dataConf *data.Database) (err error)

InitDB init db

func Migrate

func Migrate(dbConf *data.Database, cacheConf *data.CacheConf, upgradeToSpecificVersion string) error

Migrate database to current version

func UpdateInstallInfo added in v0.3.0

func UpdateInstallInfo(dataConf *data.Database, language string,
	siteName string,
	siteURL string,
	contactEmail string,
	adminName string,
	adminPassword string,
	adminEmail string) error

UpdateInstallInfo update some init data about the admin interface and admin password

Types

type Migration

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

Migration describes on migration from lower version to high version

func NewMigration

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

NewMigration creates a new migration

type QuestionPostTime added in v1.1.0

type QuestionPostTime struct {
	ID               string    `xorm:"not null pk BIGINT(20) id"`
	CreatedAt        time.Time `xorm:"not null default CURRENT_TIMESTAMP TIMESTAMP created_at"`
	UpdatedAt        time.Time `xorm:"updated_at TIMESTAMP"`
	UserID           string    `xorm:"not null default 0 BIGINT(20) INDEX user_id"`
	LastEditUserID   string    `xorm:"not null default 0 BIGINT(20) last_edit_user_id"`
	Title            string    `xorm:"not null default '' VARCHAR(150) title"`
	OriginalText     string    `xorm:"not null MEDIUMTEXT original_text"`
	ParsedText       string    `xorm:"not null MEDIUMTEXT parsed_text"`
	Status           int       `xorm:"not null default 1 INT(11) status"`
	Pin              int       `xorm:"not null default 1 INT(11) pin"`
	Show             int       `xorm:"not null default 1 INT(11) show"`
	ViewCount        int       `xorm:"not null default 0 INT(11) view_count"`
	UniqueViewCount  int       `xorm:"not null default 0 INT(11) unique_view_count"`
	VoteCount        int       `xorm:"not null default 0 INT(11) vote_count"`
	AnswerCount      int       `xorm:"not null default 0 INT(11) answer_count"`
	CollectionCount  int       `xorm:"not null default 0 INT(11) collection_count"`
	FollowCount      int       `xorm:"not null default 0 INT(11) follow_count"`
	AcceptedAnswerID string    `xorm:"not null default 0 BIGINT(20) accepted_answer_id"`
	LastAnswerID     string    `xorm:"not null default 0 BIGINT(20) last_answer_id"`
	PostUpdateTime   time.Time `xorm:"post_update_time TIMESTAMP"`
	RevisionID       string    `xorm:"not null default 0 BIGINT(20) revision_id"`
}

func (QuestionPostTime) TableName added in v1.1.0

func (QuestionPostTime) TableName() string

Jump to

Keyboard shortcuts

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