Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/server/templates/swift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ const pgTypeToSwiftType = (
swiftType = 'Float'
} else if (pgType === 'float8') {
swiftType = 'Double'
} else if (['numeric', 'decimal'].includes(pgType)) {
swiftType = 'Decimal'
} else if (pgType === 'uuid') {
swiftType = 'UUID'
} else if (
Expand Down
3 changes: 2 additions & 1 deletion test/db/00-init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ CREATE TYPE composite_type_with_array_attribute AS (my_text_array text[]);
CREATE TABLE public.users (
id bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name text,
status user_status DEFAULT 'ACTIVE'
status user_status DEFAULT 'ACTIVE',
decimal numeric
);
INSERT INTO
public.users (name)
Expand Down
22 changes: 20 additions & 2 deletions test/lib/tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ test('list', async () => {
id: expect.any(Number),
live_rows_estimate: expect.any(Number),
size: expect.any(String),
},
},
`
{
"bytes": Any<Number>,
Expand Down Expand Up @@ -78,6 +78,24 @@ test('list', async () => {
"schema": "public",
"table": "users",
},
{
"check": null,
"comment": null,
"data_type": "numeric",
"default_value": null,
"enums": [],
"format": "numeric",
"identity_generation": null,
"is_generated": false,
"is_identity": false,
"is_nullable": true,
"is_unique": false,
"is_updatable": true,
"name": "decimal",
"ordinal_position": 4,
"schema": "public",
"table": "users",
},
{
"check": null,
"comment": null,
Expand Down Expand Up @@ -139,7 +157,7 @@ test('list', async () => {
"size": Any<String>,
}
`
)
)
})

test('list without columns', async () => {
Expand Down
2 changes: 2 additions & 0 deletions test/server/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ test('query', async () => {
expect(res.json()).toMatchInlineSnapshot(`
[
{
"decimal": null,
"id": 1,
"name": "Joe Bloggs",
"status": "ACTIVE",
},
{
"decimal": null,
"id": 2,
"name": "Jane Doe",
"status": "ACTIVE",
Expand Down
Loading
Loading