Documentation
¶
Overview ¶
Package previewmigrate: Migration preview functionality for safe SQL testing Provides zero-cost error recovery by testing migrations in transactions that always rollback Features intelligent script discovery and integration with existing migration workflows Prevents dirty state issues in automated migration processes
previewmigrate: 用于安全 SQL 测试的迁移预览功能 通过在始终回滚的事务中测试迁移提供零成本错误恢复 具有智能脚本发现功能,与现有迁移工作流集成 防止自动化迁移过程中的脏状态问题
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPreviewCmd ¶
func NewPreviewCmd(getDB func() *gorm.DB, getMigration func(*gorm.DB) *migrate.Migrate, scriptsPath string) *cobra.Command
NewPreviewCmd creates preview command for migration dry-run with subcommands Uses lazy initialization - connections created only when command runs (not during command tree building) Migration factory accepts database connection parameter to share single connection (avoiding duplicate connections)
NewPreviewCmd 创建具有子命令的迁移试运行预览命令 使用延迟初始化 - 仅在命令运行时创建连接(而非命令树构建时) 迁移工厂接受数据库连接参数以共享单个连接(避免重复连接)
Types ¶
This section is empty.