简体   繁体   English

AWS Amplify API:无法从 @model 中删除 @key

[英]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.

相关问题 AWS 放大无法解析“@aws-amplify/core” - AWS amplify Can't resolve '@aws-amplify/core' 如何保护从 AWS Amplify 接收请求的 AWS Beanstalk API? - How can I secure a AWS Beanstalk API that is receiving requests from AWS Amplify? AWS Amplify:如何使用 API_KEY 进行测试和开发 - AWS Amplify: how to use API_KEY for test and development purpose 您可以从 CLI 或 API 查询 AWS Amplify 预览版本的部署状态吗? - Can you query the deployment status of an AWS Amplify preview build from the CLI or an API? 您可以从 Amplify 项目中删除 DataStore 吗? - Can you remove DataStore from an Amplify project? 无法从“aws-amplify/ui-react”导出 SignIn - Can't export SignIn from "aws-amplify/ui-react" AWS Amplify & React - 未找到模块:无法解析“@aws-amplify/analytics” - AWS Amplify & React - Module not found: Can't resolve '@aws-amplify/analytics' AWS Amplify Graph API 未经授权可访问(登录) - AWS Amplify Graph API that can be accessed without authorization (login) AWS Amplify Cognito 中的禁用用户仍然可以访问 API 中的数据 - Disabled users in AWS Amplify Cognito still can access to data in the API AWS:如何限制从 Amplify 应用程序访问 API 网关? - AWS: how to restrict access to API gateway from Amplify app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM