简体   繁体   中英

AWS Amplify API: Can't remove @key from a @model

Using AWS Amplify, I finally removed the @key attribute of one of my models (I don't need it, I want an autogenerated UUID).

When doing a amplify push I get this error

Attempting to edit the key schema of the NewsTable table in the News stack. 
An error occured during the push operation: Attempting to edit the key schema of the NewsTable table in the News stack.

How can I force it ? I don't mind losing data as it's not in production. I just don't want to hack it with a crappy rename or having to delete my whole App Sync project for this.

NOT FOR PRODUCTION. Be careful, this method erases all your data.

Assuming you need to remove the key "licenceNumber" from the "Car" model

type Car @model {
  licenceNumber: String! @key
  color: String!
}

Push anything but remove that Car model

type Car_renamed_to_make_the_push_work @model {
  licenceNumber: String!
  color: String!
}

And then rename your model again, but without the key

type Car @model {
  licenceNumber: String!
  color: String!
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM