@@ -426,6 +426,151 @@ async fn multiple_schemas_w_cross_schema_fks_w_duplicate_names_are_introspected(
426426 Ok ( ( ) )
427427}
428428
429+ #[ test_connector(
430+ tags( Mssql ) ,
431+ preview_features( "multiSchema" ) ,
432+ namespaces( "Appointments" , "Trips" , "core" )
433+ ) ]
434+ async fn schemas_with_varying_case ( api : & mut TestApi ) -> TestResult {
435+ for schema in [ "Appointments" , "Trips" , "core" ] {
436+ api. raw_cmd ( & format ! ( "CREATE SCHEMA {schema}" ) ) . await ;
437+ }
438+
439+ let setup = formatdoc ! { r#"
440+ CREATE TABLE [Appointments].[Associations] (
441+ [AppointmentID] BIGINT NOT NULL,
442+ [AssociatedAppointmentID] BIGINT NOT NULL,
443+ CONSTRAINT [PK_Associations] PRIMARY KEY CLUSTERED ([AppointmentID],[AssociatedAppointmentID])
444+ );
445+
446+ CREATE TABLE [Appointments].[AssociationTypes] (
447+ [ID] SMALLINT NOT NULL IDENTITY(1,1),
448+ CONSTRAINT [PK_AssociationTypes] PRIMARY KEY CLUSTERED ([ID])
449+ );
450+
451+ CREATE TABLE [Appointments].[billCodes] (
452+ [Id] BIGINT NOT NULL IDENTITY(1,1),
453+ CONSTRAINT [PK_AppointmentBillCode] PRIMARY KEY CLUSTERED ([Id])
454+ );
455+
456+ CREATE TABLE [core].[Clusters] (
457+ [ID] INT NOT NULL IDENTITY(1,1),
458+ CONSTRAINT [PK_Clusters] PRIMARY KEY CLUSTERED ([ID])
459+ );
460+
461+ CREATE TABLE [core].[Containers] (
462+ [ID] SMALLINT NOT NULL IDENTITY(1,1),
463+ CONSTRAINT [PK_Containers] PRIMARY KEY CLUSTERED ([ID])
464+ );
465+
466+ CREATE TABLE [Appointments].[Documents] (
467+ [ID] BIGINT NOT NULL IDENTITY(1,1),
468+ CONSTRAINT [PK_AppointmentBOLs] PRIMARY KEY CLUSTERED ([ID])
469+ );
470+
471+ CREATE TABLE [core].[Sites] (
472+ [ID] BIGINT NOT NULL IDENTITY(1,1),
473+ CONSTRAINT [PK_Sites] PRIMARY KEY CLUSTERED ([ID])
474+ );
475+
476+ CREATE TABLE [Appointments].[statuses] (
477+ [ID] SMALLINT NOT NULL IDENTITY(1,1),
478+ CONSTRAINT [PK_AppointmentStatuses] PRIMARY KEY CLUSTERED ([ID])
479+ );
480+
481+ CREATE TABLE [Trips].[Trips] (
482+ [ID] BIGINT NOT NULL IDENTITY(1,1),
483+ CONSTRAINT [PK_Trips] PRIMARY KEY CLUSTERED ([ID])
484+ );
485+
486+ CREATE TABLE [Trips].[TripTypes] (
487+ [ID] INT NOT NULL IDENTITY(1,1),
488+ CONSTRAINT [PK_TripTypes] PRIMARY KEY CLUSTERED ([ID])
489+ );
490+ "# } ;
491+
492+ api. raw_cmd ( & setup) . await ;
493+
494+ let expected = expect ! [ [ r#"
495+ generator client {
496+ provider = "prisma-client-js"
497+ previewFeatures = ["multiSchema"]
498+ }
499+
500+ datasource db {
501+ provider = "sqlserver"
502+ url = "env(TEST_DATABASE_URL)"
503+ schemas = ["Appointments", "Trips", "core"]
504+ }
505+
506+ model Associations {
507+ AppointmentID BigInt
508+ AssociatedAppointmentID BigInt
509+
510+ @@id([AppointmentID, AssociatedAppointmentID], map: "PK_Associations")
511+ @@schema("Appointments")
512+ }
513+
514+ model AssociationTypes {
515+ ID Int @id(map: "PK_AssociationTypes") @default(autoincrement()) @db.SmallInt
516+
517+ @@schema("Appointments")
518+ }
519+
520+ model billCodes {
521+ Id BigInt @id(map: "PK_AppointmentBillCode") @default(autoincrement())
522+
523+ @@schema("Appointments")
524+ }
525+
526+ model Clusters {
527+ ID Int @id(map: "PK_Clusters") @default(autoincrement())
528+
529+ @@schema("core")
530+ }
531+
532+ model Containers {
533+ ID Int @id(map: "PK_Containers") @default(autoincrement()) @db.SmallInt
534+
535+ @@schema("core")
536+ }
537+
538+ model Documents {
539+ ID BigInt @id(map: "PK_AppointmentBOLs") @default(autoincrement())
540+
541+ @@schema("Appointments")
542+ }
543+
544+ model Sites {
545+ ID BigInt @id(map: "PK_Sites") @default(autoincrement())
546+
547+ @@schema("core")
548+ }
549+
550+ model statuses {
551+ ID Int @id(map: "PK_AppointmentStatuses") @default(autoincrement()) @db.SmallInt
552+
553+ @@schema("Appointments")
554+ }
555+
556+ model Trips {
557+ ID BigInt @id(map: "PK_Trips") @default(autoincrement())
558+
559+ @@schema("Trips")
560+ }
561+
562+ model TripTypes {
563+ ID Int @id(map: "PK_TripTypes") @default(autoincrement())
564+
565+ @@schema("Trips")
566+ }
567+ "# ] ] ;
568+
569+ api. expect_datamodel ( & expected) . await ;
570+
571+ Ok ( ( ) )
572+ }
573+
429574#[ test_connector( tags( Mssql ) , preview_features( "multiSchema" ) , namespaces( "first" , "second" ) ) ]
430575async fn defaults_are_introspected ( api : & mut TestApi ) -> TestResult {
431576 let schema_name = "first" ;
0 commit comments