Documentation ¶
Index ¶
- Constants
- Variables
- func CreateMigrationTable(ctx context.Context, conn *pgx.Conn) error
- func DeleteVersionSQL(batch *pgconn.Batch, version string)
- func GetMigrationFile(version string, fsys afero.Fs) (string, error)
- func InsertVersionSQL(batch *pgconn.Batch, version, name string, stats []string)
- func Run(ctx context.Context, config pgconn.Config, version, status string, ...) error
- func UpdateMigrationTable(ctx context.Context, conn *pgx.Conn, version, status string, fsys afero.Fs) error
- type MigrationFile
Constants ¶
View Source
const ( Applied = "applied" Reverted = "reverted" )
View Source
const ( CREATE_VERSION_SCHEMA = "CREATE SCHEMA IF NOT EXISTS supabase_migrations" CREATE_VERSION_TABLE = "CREATE TABLE IF NOT EXISTS supabase_migrations.schema_migrations (version text NOT NULL PRIMARY KEY)" ADD_STATEMENTS_COLUMN = "ALTER TABLE supabase_migrations.schema_migrations ADD COLUMN IF NOT EXISTS statements text[]" ADD_NAME_COLUMN = "ALTER TABLE supabase_migrations.schema_migrations ADD COLUMN IF NOT EXISTS name text" INSERT_MIGRATION_VERSION = "INSERT INTO supabase_migrations.schema_migrations(version, name, statements) VALUES($1, $2, $3)" DELETE_MIGRATION_VERSION = "DELETE FROM supabase_migrations.schema_migrations WHERE version = $1" )
Variables ¶
View Source
var ErrInvalidVersion = errors.New("invalid version number")
Functions ¶
func CreateMigrationTable ¶ added in v1.42.0
func DeleteVersionSQL ¶
func GetMigrationFile ¶ added in v1.85.0
func InsertVersionSQL ¶
Types ¶
type MigrationFile ¶ added in v1.67.0
func NewMigrationFromFile ¶ added in v1.67.0
func NewMigrationFromFile(path string, fsys afero.Fs) (*MigrationFile, error)
func NewMigrationFromReader ¶ added in v1.67.0
func NewMigrationFromReader(sql io.Reader) (*MigrationFile, error)
func NewMigrationFromVersion ¶ added in v1.67.0
func NewMigrationFromVersion(version string, fsys afero.Fs) (*MigrationFile, error)
func (*MigrationFile) ExecBatch ¶ added in v1.67.0
func (m *MigrationFile) ExecBatch(ctx context.Context, conn *pgx.Conn) error
func (*MigrationFile) ExecBatchWithCache ¶ added in v1.67.0
func (m *MigrationFile) ExecBatchWithCache(ctx context.Context, conn *pgx.Conn) error
Click to show internal directories.
Click to hide internal directories.