migrate

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRevisionSchema = "atlas_schema_revisions"

DefaultRevisionSchema is the default schema for storing revisions table.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntRevisions

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

A EntRevisions provides implementation for the migrate.RevisionReadWriter interface.

func NewEntRevisions

func NewEntRevisions(ac *sqlclient.Client, opts ...Option) (*EntRevisions, error)

NewEntRevisions creates a new EntRevisions with the given sqlclient.Client. It is important to call EntRevisions.Init to initialize the underlying Ent client.

func (*EntRevisions) Flush

func (r *EntRevisions) Flush(ctx context.Context) error

Flush writes the changes saved in memory to the database.

This method exists to support both execution of migration in a transaction and saving revision for SQLite flavors, since attempting to write to the database while in a transaction will fail there.

func (*EntRevisions) Ident added in v0.6.0

func (r *EntRevisions) Ident() *migrate.TableIdent

Ident returns the table identifier.

func (*EntRevisions) Init

func (r *EntRevisions) Init(ctx context.Context) error

Init runs migration for the revisions' table in the connected database.

func (*EntRevisions) ReadRevision added in v0.6.0

func (r *EntRevisions) ReadRevision(ctx context.Context, v string) (*migrate.Revision, error)

ReadRevision reads a revision from the revisions table.

ReadRevision will not return results only saved in cache.

func (*EntRevisions) ReadRevisions

func (r *EntRevisions) ReadRevisions(ctx context.Context) (migrate.Revisions, error)

ReadRevisions reads the revisions from the revisions table.

ReadRevisions will not return results only saved to cache.

func (*EntRevisions) WriteRevision

func (r *EntRevisions) WriteRevision(ctx context.Context, rev *migrate.Revision) error

WriteRevision writes a revision to the revisions table.

type Option

type Option func(*EntRevisions) error

Option allows to configure EntRevisions by using functional arguments.

func WithSchema

func WithSchema(s string) Option

WithSchema configures the schema to use for the revision table.

Directories

Path Synopsis
ent

Jump to

Keyboard shortcuts

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