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