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 ({
3333 arrayTypes : PostgresType [ ]
3434 detectOneToOneRelationships : boolean
3535} ) : 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 )
3741 . 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 ) )
4643
4744 let output = `
4845export type Json = string | number | boolean | null | { [key: string]: Json | undefined } | Json[]
You can’t perform that action at this time.
0 commit comments