migration

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateFile added in v0.4.0

func GenerateFile(schemaName string, fileDescription string)

func MigrateDown added in v0.5.0

func MigrateDown(io MigrationIO) error

INFO: DOWN

func MigrateUp added in v0.5.0

func MigrateUp(io MigrationIO) error

INFO: UP

func MirrorMigration added in v0.5.1

func MirrorMigration(schemaName string, distRoot string) error

マイグレーションファイルのコピー

Types

type Github

type Github struct {
	RequiredAuth bool   `mapstructure:"REQUIRED_AUTHENTICATION"`
	Owner        string `mapstructure:"GITHUB_OWNER"`
	User         string `mapstructure:"GITHUB_USER"`
	Token        string `mapstructure:"GITHUB_TOKEN"`
}

type MigrationIO added in v0.5.0

type MigrationIO struct {
	Schema   string
	Source   string
	Database string
}

func (*MigrationIO) Show added in v0.5.0

func (io *MigrationIO) Show()

INFO: IO情報の表示

type Postgres

type Postgres struct {
	User     string `mapstructure:"POSTGRES_USER"`
	Password string `mapstructure:"POSTGRES_PASSWORD"`
	Host     string `mapstructure:"POSTGRES_HOST_NAME"`
	Port     string `mapstructure:"POSTGRES_HOST_PORT"`
	Db       string `mapstructure:"POSTGRES_DB"`
}

DB(Postgres)

func (*Postgres) DatabaseUrl

func (postgres *Postgres) DatabaseUrl(schema string) string

INFO: データベース出力先

type Source

type Source struct {
	SchemaName string     `yaml:"schema"`
	Repository string     `yaml:"gitRepository"`
	Tag        string     `yaml:"gitTag"`
	SourceType SourceType `yaml:"sourceType"`
}

type SourceSet

type SourceSet struct {
	SourceArray []Source `yaml:"sources"`
	// contains filtered or unexported fields
}

Source list

func NewSourceSet

func NewSourceSet(path string, github Github, useLocal bool) (*SourceSet, error)

ソースファイルの読み込み

func (*SourceSet) CheckSchemas added in v0.5.0

func (sources *SourceSet) CheckSchemas(schemas []string) []string

INFO: スキーマリストチェック(+ユニーク化)

func (*SourceSet) Exist

func (sources *SourceSet) Exist(schemaName string) bool

INFO: ソース存在確認

func (*SourceSet) Schemas added in v0.5.0

func (sources *SourceSet) Schemas() []string

INFO: スキーマリスト

func (*SourceSet) SourceUrl

func (sources *SourceSet) SourceUrl(schemaName string) string

INFO: ソース入力先

type SourceType

type SourceType string

----+----+----+----+----+----+----+----+----+---- migration source

var (
	GITHUB     SourceType = "github"
	LOCAL_FILE SourceType = "local"
)

Jump to

Keyboard shortcuts

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