Documentation
¶
Index ¶
- func CountDestructiveChanges(changes []schema.Change) (count int, descriptions []string)
- func DescribeChange(change schema.Change) string
- func EnsureDatabaseExists(dsn string) error
- func GenerateAtlasSQL(ctx context.Context, driver migrate.Driver, changes []schema.Change) ([]string, error)
- func GetDatabaseDSN(host, port, user, password, dbname, sslmode string) string
- func GetDatabaseURL(host, port, user, password, dbname, sslmode string) string
- func IsDestructiveChange(change schema.Change) bool
- type AtlasMigrator
- type DBConfig
- type MigrationOptions
- type MigrationResult
- type MigrationReverser
- type SimplifiedAtlasMigrator
- type TempDBManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountDestructiveChanges ¶
func DescribeChange ¶
func EnsureDatabaseExists ¶
func GenerateAtlasSQL ¶
func GetDatabaseDSN ¶
func GetDatabaseURL ¶
func IsDestructiveChange ¶
Types ¶
type AtlasMigrator ¶
type AtlasMigrator struct {
// contains filtered or unexported fields
}
AtlasMigrator handles migration generation using Atlas with simplified approach
func NewAtlasMigrator ¶
func NewAtlasMigrator(config *DBConfig) *AtlasMigrator
func (*AtlasMigrator) GenerateMigration ¶
func (m *AtlasMigrator) GenerateMigration(ctx context.Context, sourceDB *sql.DB, opts MigrationOptions) (*MigrationResult, error)
type DBConfig ¶
func NewDBConfig ¶
type MigrationOptions ¶
type MigrationOptions struct {
PackagePath string
OutputDir string
MigrationName string
DryRun bool
AllowDestructive bool
PushToDB bool
CreateDBIfNotExists bool
}
MigrationOptions contains options for migration generation
type MigrationResult ¶
type MigrationResult struct {
UpSQL string
DownSQL string
Changes []schema.Change
HasDestructive bool
DestructiveOps []string
UpFilePath string
DownFilePath string
}
MigrationResult contains the results of migration generation
type MigrationReverser ¶
type MigrationReverser struct{}
MigrationReverser handles the reversal of migration statements
func NewMigrationReverser ¶
func NewMigrationReverser() *MigrationReverser
func (*MigrationReverser) ReverseSQL ¶
func (mr *MigrationReverser) ReverseSQL(sql string) (string, error)
type SimplifiedAtlasMigrator ¶
type SimplifiedAtlasMigrator struct {
// contains filtered or unexported fields
}
SimplifiedAtlasMigrator provides a simpler Atlas-based migration
func NewSimplifiedAtlasMigrator ¶
func NewSimplifiedAtlasMigrator(config *DBConfig) *SimplifiedAtlasMigrator
type TempDBManager ¶
type TempDBManager struct {
// contains filtered or unexported fields
}
func NewTempDBManager ¶
func NewTempDBManager(baseConfig *DBConfig) *TempDBManager
func (*TempDBManager) CreateTempDB ¶
Click to show internal directories.
Click to hide internal directories.