修改后重新应用该文件:
$ kubectl apply -f schedule-table.yaml应用后,同样查看下该 migration 对象:
$ kubectl schemahero get migrations -n schemahero-tutorialIDDATABASETABLEPLANNEDEXECUTEDAPPROVEDREJECTEDa9626a8airlinedbschedule9m30s7m58s8m0seaa36efairlinedbairport4h4h4hfa32022airlinedbschedule5s可以看到多了一个新的 migration 对象处于 pending 状态 。同样使用 describe 命令查看该 migration 的详细信息 。
$ kubectl schemahero -n schemahero-tutorial describe migration fa32022Migration Name: fa32022Generated DDL Statement (generated at 2020-06-06T14:56:04-07:00):alter table "schedule" alter column "departure_time" type time, alter column "departure_time" drop not null;alter table "schedule" alter column "arrival_time" type time, alter column "arrival_time" drop not null;alter table "schedule" add column "duration" integer;To apply this migration:kubectl schemahero -n schemahero-tutorial approve migration fa32022To recalculate this migration against the current schema:kubectl schemahero -n schemahero-tutorial recalculate migration fa32022To deny and cancel this migration:kubectl schemahero -n schemahero-tutorialreject migration fa32022上面的信息中可以看到该次迁移生成的 DDL 语句包括 3 个不同的语句, SchemaHero 将我们刚刚部署的 YAML 与实际的数据库结构进行了比较,并生成了上述命令 。
同样校验下迁移语句没问题过后我们就可以直接批准该次迁移 。
$ kubectl schemahero -n schemahero-tutorial approve migration fa32022Migration fa32022 approved正常批准后表结构就变更成功了 。
到这里我们就基本上了解了 SchemaHero 的基础知识,当然 SchemaHero 还有需要功能没有介绍,可以查看官方文档
https://schemahero.io/docs/ 了解更多相关信息 。
Git 仓库:
https://github.com/schemahero/schemahero
原文链接:
https://mp.weixin.qq.com/s?__biz=MzU4MjQ0MTU4Ng==&mid=2247502093&idx=1&sn=6475044141882963eabbfca39421f3ab
推荐阅读
- 在.Net 7原生支持Webp和Heif格式文件生成
- Intel|Intel全新加速显卡Arctic Sound-M出货:8路4K云游戏无压力
- 奇瑞风云二的车到底好不好 奇瑞风云2怎么样
- 江波|精选诗词|?一路须随云露冷,只身欲返月明空
- 岳云鹏数30数字游戏 数30怎么玩必赢
- 名将赵云之死 赵云怎么死的
- 新手如何看大盘? 如何看大盘
- 云吞馅的做法和配料
- 为什么紫云英成为了矿工 为什么紫云英成为了“矿工”
- 印度法院传唤马云,究竟发生了什么事情? 马云近几天出什么事了
