diff --git a/src/pages/[platform]/build-a-backend/data/connect-to-existing-data-sources/connect-postgres-mysql-database/index.mdx b/src/pages/[platform]/build-a-backend/data/connect-to-existing-data-sources/connect-postgres-mysql-database/index.mdx index b919d0e4a35..016fff09a39 100644 --- a/src/pages/[platform]/build-a-backend/data/connect-to-existing-data-sources/connect-postgres-mysql-database/index.mdx +++ b/src/pages/[platform]/build-a-backend/data/connect-to-existing-data-sources/connect-postgres-mysql-database/index.mdx @@ -404,6 +404,7 @@ This allows the Amplify team to maintain and enhance the SQL Layer without needi | integer | a.integer() | | bigint | a.integer() | | tinyint | a.integer() | +| serial* | a.integer().default() | | float | a.float() | | double | a.float() | | decimal | a.float() | @@ -429,6 +430,8 @@ This allows the Amplify team to maintain and enhance the SQL Layer without needi | json | a.json() | | enum | a.enum() | +*Support for auto increment (serial) fields is limited to PostgreSQL datasources. + ## Troubleshooting ### Debug Mode diff --git a/src/pages/[platform]/build-a-backend/data/data-modeling/add-fields/index.mdx b/src/pages/[platform]/build-a-backend/data/data-modeling/add-fields/index.mdx index 62688b8f777..6f8f3af1682 100644 --- a/src/pages/[platform]/build-a-backend/data/data-modeling/add-fields/index.mdx +++ b/src/pages/[platform]/build-a-backend/data/data-modeling/add-fields/index.mdx @@ -233,6 +233,9 @@ const schema = a.schema({ }), }).authorization((allow) => allow.publicApiKey()); ``` + +If you're working with a Postgres datasource, `.default()` can be applied to integer fields to represent [serial fields](/[platform]/build-a-backend/data/connect-to-existing-data-sources/connect-postgres-mysql-database/#mapping-of-sql-data-types-to-field-types-for-auto-generated-schema). + **Note:** The `.default(...)` modifier can't be applied to required fields. diff --git a/src/pages/[platform]/build-a-backend/data/data-modeling/identifiers/index.mdx b/src/pages/[platform]/build-a-backend/data/data-modeling/identifiers/index.mdx index 0bbaf073608..539d765abc4 100644 --- a/src/pages/[platform]/build-a-backend/data/data-modeling/identifiers/index.mdx +++ b/src/pages/[platform]/build-a-backend/data/data-modeling/identifiers/index.mdx @@ -66,8 +66,8 @@ print("New Todo created: \(createdTodo)") If you want, you can use Amplify Data to define single-field and composite identifiers: -- Single-field identifier with a consumer-provided value (type: `id` or `string`, and must be marked `required`) -- Composite identifier with a set of consumer-provided values (type: `id` or `string`, and must be marked `required`) +- Single-field identifier with a consumer-provided value (type: `id` or `string` marked `required`, or for a [serial identifier](/[platform]/build-a-backend/data/data-modeling/add-fields/#assign-default-values-for-fields), type: `integer` marked `default`) +- Composite identifier with a set of consumer-provided values (type: `id` or `string` marked `required`, or for a [serial identifier](/[platform]/build-a-backend/data/data-modeling/add-fields/#assign-default-values-for-fields), type: `integer` marked `default`) ## Single-field identifier