File tree Expand file tree Collapse file tree
graphile/graphile-settings/src/plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,16 @@ export const ConflictDetectorPlugin: GraphileConfig.Plugin = {
2929 // Track codecs by their GraphQL name to detect conflicts
3030 const codecsByName = new Map < string , CodecInfo [ ] > ( ) ;
3131
32+ // Get configured schemas from pgServices to only check relevant codecs
33+ const configuredSchemas = new Set < string > ( ) ;
34+ const pgServices = ( build as any ) . resolvedPreset ?. pgServices ?? [ ] ;
35+
36+ for ( const service of pgServices ) {
37+ for ( const schema of service . schemas ?? [ 'public' ] ) {
38+ configuredSchemas . add ( schema ) ;
39+ }
40+ }
41+
3242 // Iterate through all codecs to find tables
3343 for ( const codec of Object . values ( build . input . pgRegistry . pgCodecs ) ) {
3444 // Skip non-table codecs (those without attributes or anonymous ones)
@@ -41,6 +51,11 @@ export const ConflictDetectorPlugin: GraphileConfig.Plugin = {
4151 const schemaName = pgExtensions ?. schemaName || 'unknown' ;
4252 const tableName = codec . name ;
4353
54+ // Skip codecs from schemas not in the configured list
55+ if ( configuredSchemas . size > 0 && ! configuredSchemas . has ( schemaName ) ) {
56+ continue ;
57+ }
58+
4459 // Get the GraphQL name that would be generated
4560 const graphqlName = build . inflection . tableType ( codec ) ;
4661
Original file line number Diff line number Diff line change @@ -114,10 +114,11 @@ export const commands = async (
114114 let hasError = false ;
115115 for ( const name of names ) {
116116 console . log ( `\n[${ name } ]` ) ;
117- const result = await generate ( {
118- ...targets [ name ] ,
119- ...cliOptions ,
120- } as GraphQLSDKConfigTarget ) ;
117+ const targetConfig = { ...targets [ name ] , ...cliOptions } as GraphQLSDKConfigTarget ;
118+ if ( targets [ name ] . db && targetConfig . db ) {
119+ targetConfig . db = { ...targets [ name ] . db , ...targetConfig . db } ;
120+ }
121+ const result = await generate ( targetConfig ) ;
121122 printResult ( result ) ;
122123 if ( ! result . success ) hasError = true ;
123124 }
Original file line number Diff line number Diff line change @@ -202,7 +202,10 @@ export function buildDbConfig(
202202) : Record < string , unknown > {
203203 const { schemas, apiNames, ...rest } = options ;
204204 if ( schemas || apiNames ) {
205- return { ...rest , db : { schemas, apiNames } } ;
205+ return {
206+ ...rest ,
207+ db : filterDefined ( { schemas, apiNames } as Record < string , unknown > ) ,
208+ } ;
206209 }
207210 return rest ;
208211}
@@ -259,5 +262,9 @@ export function buildGenerateOptions(
259262 const camelized = camelizeArgv ( answers ) ;
260263 const normalized = normalizeCodegenListOptions ( camelized ) ;
261264 const withDb = buildDbConfig ( normalized ) ;
262- return { ...fileConfig , ...withDb } as GraphQLSDKConfigTarget ;
265+ const merged = { ...fileConfig , ...withDb } as GraphQLSDKConfigTarget ;
266+ if ( fileConfig . db && merged . db ) {
267+ merged . db = { ...fileConfig . db , ...merged . db } ;
268+ }
269+ return merged ;
263270}
You can’t perform that action at this time.
0 commit comments