migration

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: GPL-3.0 Imports: 17 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 {
	// contains filtered or unexported fields
}

Migration generator

func (*Migration) Generate

func (m *Migration) Generate(input *parser.Parser, conf *config.Config) error

Generate generates migration

func (*Migration) GetContent

func (m *Migration) GetContent() string

GetContent return generated migration content

func (*Migration) Save

func (m *Migration) Save() error

Save saves generated migration to file

type PivotMigration

type PivotMigration struct {
	Tables []PivotMigrationEntry
	Config *config.Config
}

PivotMigration generator

func (*PivotMigration) Generate

func (p *PivotMigration) Generate() error

Generate generates pivot migration

func (*PivotMigration) Init

func (p *PivotMigration) Init(tables []PivotMigrationEntry, conf *config.Config)

Init initializes pivot generator

type PivotMigrationEntry

type PivotMigrationEntry struct {
	TableOne string
	TableTwo string
}

PivotMigrationEntry

type Table

type Table struct {
	Name        string `db:"name"`
	Columns     []fizz.Column
	Indexes     []fizz.Index
	ForeignKeys []fizz.ForeignKey

	Options map[string]interface{}
	// contains filtered or unexported fields
}

Table is the table definition for fizz.

func NewTable

func NewTable(name string, opts map[string]interface{}) Table

NewTable creates a new Table.

func (*Table) Column

func (t *Table) Column(name string, colType string, options fizz.Options) error

Column adds a column to the table definition.

func (Table) Fizz

func (t Table) Fizz() string

Fizz returns the fizz DDL to create the table.

func (*Table) ForeignKey

func (t *Table) ForeignKey(column string, refs interface{}, options fizz.Options) error

ForeignKey adds a new foreign key to the table definition.

func (*Table) HasColumns

func (t *Table) HasColumns(args ...string) bool

HasColumns checks if the Table has all the given columns.

func (*Table) PrimaryKey

func (t *Table) PrimaryKey(pk ...string) error

PrimaryKey adds a primary key to the table. It's useful to define a composite primary key.

func (Table) String

func (t Table) String() string

func (*Table) Timestamp

func (t *Table) Timestamp(name string) error

Timestamp is a shortcut to add a timestamp column with default options.

func (Table) UnFizz

func (t Table) UnFizz() string

UnFizz returns the fizz DDL to remove the table.

Jump to

Keyboard shortcuts

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