diff --git a/atlasaction/comments/schema-plan.tmpl b/atlasaction/comments/schema-plan.tmpl index da1cea89..68069019 100644 --- a/atlasaction/comments/schema-plan.tmpl +++ b/atlasaction/comments/schema-plan.tmpl @@ -12,15 +12,28 @@ {{- template "schema-lint" . -}}
- 📝 To edit this plan, follow these steps -
    -
  1. Run atlas schema plan pull --url "{{ .Plan.File.URL }}" > {{ .Plan.File.Name }}.plan.hcl
  2. -
  3. Modify the plan.
  4. -
  5. Push the plan using atlas schema plan push --pending --env {{ .EnvName }} --file {{ .Plan.File.Name }}.plan.hcl
  6. - {{- if .RerunCommand -}} -
  7. Re-trigger this action using {{ .RerunCommand }}
  8. - {{- end -}} -
+📝 Steps to edit this migration plan + +1\. Run the following command to pull the generated plan to your local workstation: +```bash +atlas schema plan pull --url "{{ .Plan.File.URL }}" > {{ .Plan.File.Name }}.plan.hcl +``` + +2\. Open `{{ .Plan.File.Name }}` in your editor and modify it as needed. Note that the result of the plan should align +the database with the desired state. Otherwise, Atlas will report a schema drift. + +3\. Push the updated plan to the registry using the following command: +```bash +atlas schema plan push --pending --env {{ .EnvName }} --file {{ .Plan.File.Name }}.plan.hcl +``` + +{{- if .RerunCommand }} +4\. Re-trigger the `schema/plan` action to update this comment: +```bash +{{ .RerunCommand }} +``` +{{- end }} +
{{- define "schema-lint" -}} diff --git a/atlasaction/testdata/gitlab/schema-plan.txtar b/atlasaction/testdata/gitlab/schema-plan.txtar index 66db036e..d075e45a 100644 --- a/atlasaction/testdata/gitlab/schema-plan.txtar +++ b/atlasaction/testdata/gitlab/schema-plan.txtar @@ -138,9 +138,19 @@ CREATE TABLE `1` (

- 📝 To edit this plan, follow these steps -
    -
  1. Run atlas schema plan pull --url "atlas://app/plans/20241010143904" > 20241010143904.plan.hcl
  2. -
  3. Modify the plan.
  4. -
  5. Push the plan using atlas schema plan push --pending --env --file 20241010143904.plan.hcl
+📝 Steps to edit this migration plan + +1\. Run the following command to pull the generated plan to your local workstation: +```bash +atlas schema plan pull --url "atlas://app/plans/20241010143904" > 20241010143904.plan.hcl +``` + +2\. Open `20241010143904` in your editor and modify it as needed. Note that the result of the plan should align +the database with the desired state. Otherwise, Atlas will report a schema drift. + +3\. Push the updated plan to the registry using the following command: +```bash +atlas schema plan push --pending --env --file 20241010143904.plan.hcl +``` +
\ No newline at end of file