Skip to content

Commit 6f30dfc

Browse files
committed
Merge conflict
1 parent ef68c9e commit 6f30dfc

2 files changed

Lines changed: 40 additions & 40 deletions

File tree

pgpm/export/src/export-meta.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,6 @@ import type { Pool } from 'pg';
55

66
import { FieldType, TableConfig, META_TABLE_CONFIG } from './export-utils';
77

8-
/**
9-
* Map PostgreSQL data types to FieldType values.
10-
* Uses udt_name from information_schema which gives the base type name.
11-
*/
12-
const mapPgTypeToFieldType = (udtName: string): FieldType => {
13-
switch (udtName) {
14-
case 'uuid':
15-
return 'uuid';
16-
case '_uuid':
17-
return 'uuid[]';
18-
case 'text':
19-
case 'varchar':
20-
case 'bpchar':
21-
case 'name':
22-
return 'text';
23-
case '_text':
24-
case '_varchar':
25-
return 'text[]';
26-
case 'bool':
27-
return 'boolean';
28-
case 'jsonb':
29-
case 'json':
30-
return 'jsonb';
31-
case '_jsonb':
32-
return 'jsonb[]';
33-
case 'int4':
34-
case 'int8':
35-
case 'int2':
36-
case 'numeric':
37-
return 'int';
38-
case 'interval':
39-
return 'interval';
40-
case 'timestamptz':
41-
case 'timestamp':
42-
return 'timestamptz';
43-
default:
44-
return 'text';
45-
}
46-
};
47-
488
/**
499
* Query actual columns from information_schema for a given table.
5010
* Returns a map of column_name -> udt_name (PostgreSQL type).

pgpm/export/src/export-utils.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,46 @@ export const DB_REQUIRED_EXTENSIONS = [
3838
'pgpm-types'
3939
] as const;
4040

41+
/**
42+
* Map PostgreSQL data types to FieldType values.
43+
* Uses udt_name from information_schema which gives the base type name.
44+
*/
45+
const mapPgTypeToFieldType = (udtName: string): FieldType => {
46+
switch (udtName) {
47+
case 'uuid':
48+
return 'uuid';
49+
case '_uuid':
50+
return 'uuid[]';
51+
case 'text':
52+
case 'varchar':
53+
case 'bpchar':
54+
case 'name':
55+
return 'text';
56+
case '_text':
57+
case '_varchar':
58+
return 'text[]';
59+
case 'bool':
60+
return 'boolean';
61+
case 'jsonb':
62+
case 'json':
63+
return 'jsonb';
64+
case '_jsonb':
65+
return 'jsonb[]';
66+
case 'int4':
67+
case 'int8':
68+
case 'int2':
69+
case 'numeric':
70+
return 'int';
71+
case 'interval':
72+
return 'interval';
73+
case 'timestamptz':
74+
case 'timestamp':
75+
return 'timestamptz';
76+
default:
77+
return 'text';
78+
}
79+
};
80+
4181
/**
4282
* Required extensions for service/meta exports.
4383
* Includes native PostgreSQL extensions and pgpm modules for metadata management.

0 commit comments

Comments
 (0)