migration

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	M1 = &xormigrate.Migration{
		ID:          "initial-migration",
		Description: "[M1] Create base set of tables",
		Migrate: func(tx *xorm.Engine) error {

			return tx.Sync2(new(M1Tag), new(M1Bookmark), new(M1BookmarkTag), new(M1Account))
		},
		Rollback: func(tx *xorm.Engine) error {
			return tx.DropTables(new(M1Tag), new(M1Bookmark), new(M1BookmarkTag), new(M1Account))
		},
	}
)

Functions

This section is empty.

Types

type M1Account

type M1Account struct {
	ID       int `xorm:"'id' pk autoincr"`
	Username string
	Password string
	Created  time.Time `xorm:"created"`
	Updated  time.Time `xorm:"updated"`
}

func (M1Account) TableName

func (m M1Account) TableName() string

type M1Bookmark

type M1Bookmark struct {
	ID          int       `xorm:"'id' pk autoincr"`
	URL         string    `xorm:"url"`
	Title       string    `xorm:"'title' NOT NULL"`
	ImageURL    string    `xorm:"'image_url' NOT NULL"`
	Excerpt     string    `xorm:"'excerpt' NOT NULL"`
	Author      string    `xorm:"'author' NOT NULL"`
	MinReadTime int       `xorm:"'min_read_time' DEFAULT 0"`
	MaxReadTime int       `xorm:"'max_read_time' DEFAULT 0"`
	Modified    time.Time `xorm:"modified"`
	Content     string    `xorm:"TEXT 'content'"`
	HTML        string    `xorm:"TEXT 'html'"`
	HasContent  bool      `xorm:"has_content"`
	Created     time.Time `xorm:"created"`
	Updated     time.Time `xorm:"updated"`
}

func (M1Bookmark) TableName

func (m M1Bookmark) TableName() string

type M1BookmarkTag

type M1BookmarkTag struct {
	BookmarkID int `xorm:"bookmark_id"`
	TagID      int `xorm:"tag_id"`
}

func (M1BookmarkTag) TableName

func (m M1BookmarkTag) TableName() string

type M1Tag

type M1Tag struct {
	ID        int `xorm:"'id' pk autoincr"`
	Name      string
	Deleted   bool
	NBookmark int       `xorm:"n_bookmarks"`
	Created   time.Time `xorm:"created"`
	Updated   time.Time `xorm:"updated"`
}

func (M1Tag) TableName

func (m M1Tag) TableName() string

Jump to

Keyboard shortcuts

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