| 30 | ) |
| 31 | |
| 32 | type MigrationDatabase interface { |
| 33 | //获取当前的版本 |
| 34 | Version() int64 |
| 35 | //校验当前是否可更新 |
| 36 | ValidUpdate(version int64) error |
| 37 | //校验并备份表结构 |
| 38 | ValidForBackupTableSchema() error |
| 39 | //校验并更新表结构 |
| 40 | ValidForUpdateTableSchema() error |
| 41 | //恢复旧数据 |
| 42 | MigrationOldTableData() error |
| 43 | //插入新数据 |
| 44 | MigrationNewTableData() error |
| 45 | //增加迁移记录 |
| 46 | AddMigrationRecord(version int64) error |
| 47 | //最后的清理工作 |
| 48 | MigrationCleanup() error |
| 49 | //回滚本次迁移 |
| 50 | RollbackMigration() error |
| 51 | } |
| 52 | |
| 53 | type migrationCache struct { |
| 54 | items *list.List |
no outgoing calls
no test coverage detected