- Newest
- Most votes
- Most comments
Based on the available information, AWS Amplify's capability to automatically populate timestamp fields like createdAt and updatedAt is primarily designed for DynamoDB-backed data models created with a.model().
When connecting to existing SQL databases like MySQL, Amplify has recently added support for using existing MySQL and PostgreSQL databases for GraphQL APIs through Amplify's Cloud Development Kit (CDK) construct. However, the automatic population of timestamp fields in these existing SQL databases isn't explicitly confirmed in the provided sources.
For your specific case with MySQL in RDS, here are some recommendations:
-
Column naming: Try using the camelCase format (
createdAt,updatedAt) to match Amplify's conventions, as this is the format used in DynamoDB models. -
Data types: Use appropriate timestamp data types in MySQL that are compatible with Amplify's expected formats (TIMESTAMP or DATETIME).
-
Alternative approach: If automatic population doesn't work, you could:
- Handle timestamps in your application code before sending mutations
- Create database triggers in MySQL to automatically update these fields
- Use the extensibility features of Amplify to customize the behavior
Since Amplify is built on AWS CDK, you might be able to extend its functionality to handle these timestamp fields according to your requirements.
If you continue to face issues, you might want to check the latest Amplify documentation or community forums, as this feature might have specific requirements or limitations when working with existing SQL databases that aren't fully detailed in the available information.
Sources
Community | AWS open source newsletter, #183
Building RAG-based applications with AWS Amplify AI Kit and Neon Postgres | Front-End Web & Mobile
AWS Amplify | Extensible Web & Mobile Apps | Amazon Web Services
Full Stack Development - Web and Mobile Apps - AWS Amplify
answered a year ago
Relevant content
asked 2 years ago
asked 2 years ago
- AWS OFFICIALUpdated 5 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 4 years ago
