migration

package
v0.0.0-...-7a9e484 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package migration provides tools for performing data migrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Driver     string `json:"driver"`
	DSN        string `json:"dsn"`
	DropSchema bool   `json:"drop_schema"`
}

Config concludes important configuration values which will be consumed by the migration manager.

type Manger

type Manger struct {
	// contains filtered or unexported fields
}

Manager represents a migration manager. Using a provided database connection it will migrate (i. e. create the database table schema) for all entities.

func NewManager

func NewManager(config *Config) (*Manger, error)

NewManager creates a new manager instance and returns a reference to it. config has to be ready to use for the manager, populated with useful values.

func (*Manger) RunPreparation

func (m *Manger) RunPreparation()

RunPreparation `prepares` the database, meaning that it will create one or more table for each entity, depending on their Create method. Dropping each table requires an explicit opt-in flag.

Jump to

Keyboard shortcuts

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