migrations

package
v0.0.0-...-808fada Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migration

type Migration struct {
	gorm.Model

	Name        string `gorm:"type:varchar(100);unique_index"`
	Succuessful bool
}

Migration a migration

type MigrationFile

type MigrationFile interface {
	Up(*gorm.DB) error
	Down(*gorm.DB) error
	Name() string
}

MigrationFile a migration file

func NewInitialMigration

func NewInitialMigration() MigrationFile

NewInitialMigration returns the initialMigration

func NewMenuMigration

func NewMenuMigration() MigrationFile

NewMenuMigration returns a new menu migration

type Migrator

type Migrator struct {
	DB         *gorm.DB
	Migrations []Migration
	MigrateUp  bool
	Files      map[string]MigrationFile
}

Migrator migrates

func NewMigrator

func NewMigrator(db *gorm.DB, up bool) (*Migrator, error)

NewMigrator returns a new Migrator

func (*Migrator) RunMigrations

func (mig *Migrator) RunMigrations() error

RunMigrations runs all our migrations (if they haven't been run successfully)

Jump to

Keyboard shortcuts

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