Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have delete a api, now i want to undo the operation. #1402

Closed
hafizali05 opened this issue May 4, 2019 · 5 comments
Closed

I have delete a api, now i want to undo the operation. #1402

hafizali05 opened this issue May 4, 2019 · 5 comments
Labels
pending-response Issue is pending response from the issue author platform Issues tied to the general CLI platform question General question

Comments

@hafizali05
Copy link

** Which Category is your question related to? **
amplify add and remove api
** What AWS Services are you utilizing? **
AWS APPSYNC amplify api remove
** Provide additional details e.g. code snippets **

1: I have added an api
2. i made the changes to the api but havent pushed the changes
3. i didnt like the stuff i did in there and so i deleted it.
3. its as shown in the image.
4 now i want to undo the operation which says remove.

how do i do that.

P.S i havent done amplify push yet.

image

@hafizali05 hafizali05 changed the title I have delete a api, now i want to undo the action. I have delete a api, now i want to undo the operation. May 4, 2019
@powerful23
Copy link
Contributor

Transferring to the CLI repo.

@powerful23 powerful23 transferred this issue from aws-amplify/amplify-js May 6, 2019
@UnleashedMind
Copy link
Contributor

UnleashedMind commented May 6, 2019

@hafizali05
Just want to get exactly what happened. You've created and pushed your api before, and the api related resources have already been created in the cloud, right?
Then you made local changes without pushing them to the cloud, but you don't want to keep those local changes.

The CLI currently does not have undo command. But there's a simple workaround.

  1. thoroughly backup your project so you can recover if things go wrong.
  2. copy the api folder from #current-cloud-backend folder to the backend folder.
  3. copy the "api" section in the amplify-meta.json from the #current-cloud-backend folder to the backend folder.
  4. copy the "api" section in the backend-config.json from the #current-cloud-backend folder to the backend folder.
  5. run amplify api gql-compile

then if you execute "amplify status", you will see that the api category is not changed, and you can continue your development normally.

@UnleashedMind UnleashedMind added pending-response Issue is pending response from the issue author platform Issues tied to the general CLI platform question General question labels May 6, 2019
@hafizali05
Copy link
Author

hafizali05 commented May 7, 2019

I did amplify env pull --restore and it was back to what I wanted.

Although it may slightly contradict to what I asked for as I wanted a state where it's not deleted and still keep the changes.

Pull restore takes me from start but than still I can do the cleaner way for my use case

@JoeLamptey
Copy link

I had a similar challenged but I resolved it by copying and replacing my #current_cloud_backend folder with the backend folder. In my case, the locally served app was faultless so check again before you follow this approach.

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pending-response Issue is pending response from the issue author platform Issues tied to the general CLI platform question General question
Projects
None yet
Development

No branches or pull requests

4 participants