migrations

package
v0.0.0-...-70b0837 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Migrations = []*gormigrate.Migration{
	&V202005031209CreateUserTable,
}

Migrations List of migrations to do on startup

View Source
var V202005031209CreateUserTable = gormigrate.Migration{
	ID: "202005031209",
	Migrate: CreateTableMigration(
		&userV202005031209{},
		&rememberMeV202005031308{},
	),
	Rollback: func(tx *gorm.DB) error {
		DropForeignKeys(tx,
			&userV202005031209{},
			&rememberMeV202005031308{},
		)

		if tx.Error != nil {
			return tx.Error
		}

		return tx.DropTableIfExists(
			&userV202005031209{},
			&rememberMeV202005031308{},
		).Error
	},
}

Functions

func AddForeignKeys

func AddForeignKeys(db *gorm.DB, values ...interface{})

AddForeignKeys must be called on tables to define forein key settings

func CreateTableMigration

func CreateTableMigration(tables ...tableInterface) func(tx *gorm.DB) error

func DropForeignKeys

func DropForeignKeys(db *gorm.DB, values ...interface{})

DropForeignKeys must be called on rollbacks when AddForeignKeys is called

Types

This section is empty.

Jump to

Keyboard shortcuts

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