[英]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).使用 AWS Amplify,我终于删除了我的一个模型的 @key 属性(我不需要它,我想要一个自动生成的 UUID)。
When doing a amplify push
I get this error进行
amplify push
我收到此错误
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.
我只是不想用糟糕的重命名来破解它,也不想为此删除我的整个 App Sync 项目。
NOT FOR PRODUCTION.不用于生产。 Be careful, this method erases all your data.
请注意,此方法会删除您的所有数据。
Assuming you need to remove the key "licenceNumber" from the "Car" model假设您需要从“Car”模型中删除密钥“licenceNumber”
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!
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.