migrations

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

README

Creating a new migration

  1. Create a new file based on the current date and time (see existing migration format)
  2. Copy the following code and update MY_ID_HERE and MY_COMMENT_HERE and DO_SOMETHING_HERE
  3. Add the ID to the list of migrations in migrate.go
package migrations

import (
  "github.com/go-gormigrate/gormigrate/v2"
  "gorm.io/gorm"
)

// MY_COMMENT_HERE
var _MY_ID_HERE = &gormigrate.Migration {
  ID: "MY_ID_HERE",
  Migrate: func(tx *gorm.DB) error {
    return DO_SOMETHING_HERE.Error;
  },
  Rollback: func(tx *gorm.DB) error {
    return nil;
  },
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(gormDB *gorm.DB) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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