File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -33,16 +33,13 @@ export const apply = async ({
33
33
arrayTypes : PostgresType [ ]
34
34
detectOneToOneRelationships : boolean
35
35
} ) : Promise < string > => {
36
- const columnsByTableId = columns
36
+ const columnsByTableId = Object . fromEntries < PostgresColumn [ ] > (
37
+ [ ...tables , ...views , ...materializedViews ] . map ( ( t ) => [ t . id , [ ] ] )
38
+ )
39
+ columns
40
+ . filter ( ( c ) => c . table_id in columnsByTableId )
37
41
. sort ( ( { name : a } , { name : b } ) => a . localeCompare ( b ) )
38
- . reduce (
39
- ( acc , curr ) => {
40
- acc [ curr . table_id ] ??= [ ]
41
- acc [ curr . table_id ] . push ( curr )
42
- return acc
43
- } ,
44
- { } as Record < string , PostgresColumn [ ] >
45
- )
42
+ . forEach ( ( c ) => columnsByTableId [ c . table_id ] . push ( c ) )
46
43
47
44
let output = `
48
45
export type Json = string | number | boolean | null | { [key: string]: Json | undefined } | Json[]
You can’t perform that action at this time.
0 commit comments