Add mix task to undo latest codegen/delete latest migration

未关闭
#490 16 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
elixir, postgresql
领域
cli, databases

调研方向

首先定位生成迁移的 mix task,以及负责迁移文件和表快照文件的代码。跟踪最新迁移及其关联快照的识别方式,然后查看现有的任务测试或迁移生成测试。当名为 ash_postgres.delete_latest_migration 的任务在确认迁移名称后,仅删除最新迁移及其快照时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

enhancement needs review

Is your feature request related to a problem? Please describe.

Codegen to generate a migration is really awesome, but sometimes you generate a migration and then you realize you missed something, so you want to delete that migration, make the change, and then generate it again. Currently that's a manual process - go find the migration, find the snapshots for all the relevant tables, delete them all, and do it again. It's pretty annoying!

Describe the solution you'd like

A task like ash_postgres.delete_latest_migration that will delete the last migration, and any snapshots that were created at the same time. No option to delete other migrations or anything like that - only the last one.

And it should probably confirm the name of the migration just to make sure!

Describe alternatives you've considered

You could just generate another migration with the added changes, but snapshot files are big and ugly and if you haven't even run the first migration, being able to undo/regenerate it seems like the smarter approach.

主要语言
Elixir
星标
191
派生
186
平均合并
16 小时 4 分钟
30 天内合并 PR
17

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ash-project/ash_postgres 的其他 Issue

查看 ash-project/ash_postgres 的全部 Issue

相似的 Issue

更多 Elixir Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。