Skip to content

Commit 29376f6

Browse files
committed
doc(data): support for auto increment (serial) fields
1 parent 7b833e8 commit 29376f6

File tree

2 files changed

+6
-0
lines changed
  • src/pages/[platform]/build-a-backend/data
    • connect-to-existing-data-sources/connect-postgres-mysql-database
    • data-modeling/add-fields

2 files changed

+6
-0
lines changed

src/pages/[platform]/build-a-backend/data/connect-to-existing-data-sources/connect-postgres-mysql-database/index.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ This allows the Amplify team to maintain and enhance the SQL Layer without needi
404404
| integer | a.integer() |
405405
| bigint | a.integer() |
406406
| tinyint | a.integer() |
407+
| serial* | a.integer().default() |
407408
| float | a.float() |
408409
| double | a.float() |
409410
| decimal | a.float() |
@@ -429,6 +430,8 @@ This allows the Amplify team to maintain and enhance the SQL Layer without needi
429430
| json | a.json() |
430431
| enum | a.enum() |
431432

433+
*Support for auto increment (serial) fields is limited to PostgreSQL datasources.
434+
432435
## Troubleshooting
433436

434437
### Debug Mode

src/pages/[platform]/build-a-backend/data/data-modeling/add-fields/index.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ const schema = a.schema({
233233
}),
234234
}).authorization((allow) => allow.publicApiKey());
235235
```
236+
237+
If you're working with a Postgres datasource, `.default()` can be used 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).
238+
236239
<Callout>
237240
**Note:** The `.default(...)` modifier can't be applied to required fields.
238241
</Callout>

0 commit comments

Comments
 (0)