@@ -111,8 +111,27 @@ test("mysql", async () => {
111111 expect ( commentsLatestJsonContent ) . toMatchSnapshot ( "comments-latest.json" ) ;
112112} ) ;
113113
114+ test ( "multi-file-schema" , async ( ) => {
115+ // Arrange
116+ const name = "multi-file-schema" ;
117+
118+ // Act
119+ executeGenerate ( name ) ;
120+
121+ // Assert
122+ const migrationSqlContent = readMigrationSql ( name ) ;
123+ expect ( migrationSqlContent ) . toMatchSnapshot ( "migration.sql" ) ;
124+
125+ const commentsLatestJsonContent = readCommentsLatestJson ( name ) ;
126+ expect ( commentsLatestJsonContent ) . toMatchSnapshot ( "comments-latest.json" ) ;
127+ } ) ;
128+
114129const executeGenerate = ( name : string ) => {
115- const schemaPath = path . join ( fixturesDir , name , "schema.prisma" ) ;
130+ // For multi-file-schema, use the schema folder instead of schema.prisma file
131+ const schemaPath =
132+ name === "multi-file-schema"
133+ ? path . join ( fixturesDir , name , "schema" )
134+ : path . join ( fixturesDir , name , "schema.prisma" ) ;
116135 child_process . execSync ( `npx prisma generate --schema ${ schemaPath } ` ) ;
117136} ;
118137
@@ -155,5 +174,9 @@ const readMigrationSql = (name: string): string => {
155174} ;
156175
157176const getMigrationsDir = ( name : string ) => {
177+ // For multi-file-schema, migrations are in the schema subfolder
178+ if ( name === "multi-file-schema" ) {
179+ return path . join ( fixturesDir , name , "schema" , "migrations" ) ;
180+ }
158181 return path . join ( fixturesDir , name , "migrations" ) ;
159182} ;
0 commit comments