File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -48,9 +48,12 @@ generatorHandler({
48
48
options . dmmf . datamodel . models
49
49
) ;
50
50
51
+ const hasMultiSchema = options . datasources . some (
52
+ ( d ) => d . schemas . length > 0
53
+ ) ;
54
+
51
55
const multiSchemaMap =
52
- config . groupBySchema ||
53
- options . generator . previewFeatures ?. includes ( "multiSchema" )
56
+ config . groupBySchema || hasMultiSchema
54
57
? parseMultiSchemaMap ( options . datamodel )
55
58
: undefined ;
56
59
@@ -69,10 +72,7 @@ generatorHandler({
69
72
) ;
70
73
71
74
// Extend model table names with schema names if using multi-schemas
72
- if (
73
- options . generator . previewFeatures ?. includes ( "multiSchema" ) ||
74
- options . datasources . some ( ( d ) => d . schemas . length > 0 )
75
- ) {
75
+ if ( hasMultiSchema ) {
76
76
const filterBySchema = config . filterBySchema
77
77
? new Set ( config . filterBySchema )
78
78
: null ;
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export const convertToMultiSchemaModels = <const T extends ModelLike>(
28
28
return models . flatMap ( ( model ) => {
29
29
const schemaName = multiSchemaMap ?. get ( model . typeName ) ;
30
30
31
- if ( ! schemaName || schemaName === defaultSchema ) {
31
+ if ( ! schemaName ) {
32
32
return model ;
33
33
}
34
34
@@ -37,6 +37,11 @@ export const convertToMultiSchemaModels = <const T extends ModelLike>(
37
37
return [ ] ;
38
38
}
39
39
40
+ // If the schema is the default schema, we don't need to modify the model
41
+ if ( schemaName === defaultSchema ) {
42
+ return model ;
43
+ }
44
+
40
45
return [
41
46
{
42
47
...model ,
You can’t perform that action at this time.
0 commit comments