diff --git a/prisma-fmt/src/get_datamodel.rs b/prisma-fmt/src/get_datamodel.rs index 202d89955033..14ecaaa255bf 100644 --- a/prisma-fmt/src/get_datamodel.rs +++ b/prisma-fmt/src/get_datamodel.rs @@ -63,6 +63,7 @@ mod tests { { "name": "User", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -74,6 +75,7 @@ mod tests { "isReadOnly": false, "hasDefaultValue": true, "type": "Int", + "nativeType": null, "default": { "name": "autoincrement", "args": [] @@ -91,6 +93,7 @@ mod tests { "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -104,6 +107,7 @@ mod tests { "isReadOnly": false, "hasDefaultValue": false, "type": "Post", + "nativeType": null, "relationName": "PostToUser", "relationFromFields": [], "relationToFields": [], @@ -119,6 +123,7 @@ mod tests { { "name": "Post", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -130,6 +135,7 @@ mod tests { "isReadOnly": false, "hasDefaultValue": true, "type": "Int", + "nativeType": null, "default": { "name": "autoincrement", "args": [] @@ -147,6 +153,7 @@ mod tests { "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -160,6 +167,7 @@ mod tests { "isReadOnly": false, "hasDefaultValue": false, "type": "User", + "nativeType": null, "relationName": "PostToUser", "relationFromFields": [ "authorId" @@ -180,6 +188,7 @@ mod tests { "isReadOnly": true, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } diff --git a/prisma-fmt/src/get_dmmf.rs b/prisma-fmt/src/get_dmmf.rs index d398b3f131b9..26ec932242fc 100644 --- a/prisma-fmt/src/get_dmmf.rs +++ b/prisma-fmt/src/get_dmmf.rs @@ -373,6 +373,7 @@ mod tests { { "name": "A", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -384,6 +385,7 @@ mod tests { "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -397,6 +399,7 @@ mod tests { "isReadOnly": true, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -410,6 +413,7 @@ mod tests { "isReadOnly": false, "hasDefaultValue": false, "type": "B", + "nativeType": null, "relationName": "AToB", "relationFromFields": [ "b_id" @@ -429,6 +433,7 @@ mod tests { { "name": "B", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -440,6 +445,7 @@ mod tests { "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -453,6 +459,7 @@ mod tests { "isReadOnly": false, "hasDefaultValue": false, "type": "A", + "nativeType": null, "relationName": "AToB", "relationFromFields": [], "relationToFields": [], diff --git a/query-engine/dmmf/src/ast_builders/datamodel_ast_builder.rs b/query-engine/dmmf/src/ast_builders/datamodel_ast_builder.rs index e9403d150cc7..7c202dd962d5 100644 --- a/query-engine/dmmf/src/ast_builders/datamodel_ast_builder.rs +++ b/query-engine/dmmf/src/ast_builders/datamodel_ast_builder.rs @@ -66,6 +66,7 @@ fn composite_type_to_dmmf(ct: walkers::CompositeTypeWalker<'_>) -> Model { Model { name: ct.name().to_owned(), db_name: None, + schema: None, fields: ct .fields() .filter(|field| !matches!(field.r#type(), ScalarFieldType::Unsupported(_))) @@ -94,6 +95,9 @@ fn composite_type_field_to_dmmf(field: walkers::CompositeTypeFieldWalker<'_>) -> is_id: false, is_read_only: false, has_default_value: field.default_value().is_some(), + native_type: field + .raw_native_type() + .map(|(_, name, args, ..)| (name.to_string(), args.to_vec())), default: field .default_value() .map(|dv| default_value_to_serde(&dml_default_kind(dv, field.scalar_type()))), @@ -127,6 +131,7 @@ fn model_to_dmmf(model: walkers::ModelWalker<'_>) -> Model { Model { name: model.name().to_owned(), db_name: model.mapped_name().map(ToOwned::to_owned), + schema: model.schema().map(|(s, _)| s.to_owned()), fields: model .fields() .filter(|field| !should_skip_model_field(field)) @@ -195,6 +200,9 @@ fn scalar_field_to_dmmf(field: walkers::ScalarFieldWalker<'_>) -> Field { ScalarFieldType::BuiltInScalar(st) => st.as_str().to_owned(), ScalarFieldType::Unsupported(_) => unreachable!(), }, + native_type: field + .raw_native_type() + .map(|(_, name, args, ..)| (name.to_string(), args.to_vec())), default: field .default_value() .map(|dv| default_value_to_serde(&dml_default_kind(dv.value(), field.scalar_type()))), @@ -221,6 +229,7 @@ fn relation_field_to_dmmf(field: walkers::RelationFieldWalker<'_>) -> Field { is_read_only: false, has_default_value: false, field_type: field.related_model().name().to_owned(), + native_type: None, default: None, relation_name: Some(field.relation_name().to_string()), relation_from_fields: Some( diff --git a/query-engine/dmmf/src/serialization_ast/datamodel_ast.rs b/query-engine/dmmf/src/serialization_ast/datamodel_ast.rs index f405aec2be00..8e5949d0f8a7 100644 --- a/query-engine/dmmf/src/serialization_ast/datamodel_ast.rs +++ b/query-engine/dmmf/src/serialization_ast/datamodel_ast.rs @@ -25,6 +25,8 @@ pub struct Field { #[serde(rename = "type")] pub field_type: String, + pub native_type: Option<(String, Vec)>, + #[serde(skip_serializing_if = "Option::is_none")] pub default: Option, @@ -62,6 +64,8 @@ pub struct Function { pub struct Model { pub name: String, pub db_name: Option, + pub schema: Option, + pub fields: Vec, pub primary_key: Option, pub unique_fields: Vec>, diff --git a/query-engine/dmmf/src/tests/test-schemas/snapshots/odoo.snapshot.json.gz b/query-engine/dmmf/src/tests/test-schemas/snapshots/odoo.snapshot.json.gz index 7d1c94c67d19..742636528d45 100644 Binary files a/query-engine/dmmf/src/tests/test-schemas/snapshots/odoo.snapshot.json.gz and b/query-engine/dmmf/src/tests/test-schemas/snapshots/odoo.snapshot.json.gz differ diff --git a/query-engine/dmmf/test_files/functions.json b/query-engine/dmmf/test_files/functions.json index 7a0f0ee925a4..0f1280c66847 100644 --- a/query-engine/dmmf/test_files/functions.json +++ b/query-engine/dmmf/test_files/functions.json @@ -4,6 +4,7 @@ { "name": "User", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -15,6 +16,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -28,6 +30,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "DateTime", + "nativeType": null, "default": { "name": "now", "args": [] @@ -45,6 +48,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "String", + "nativeType": null, "default": { "name": "cuid", "args": [ @@ -64,6 +68,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "String", + "nativeType": null, "default": { "name": "cuid", "args": [ @@ -83,6 +88,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "String", + "nativeType": null, "default": { "name": "cuid", "args": [ @@ -102,6 +108,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "String", + "nativeType": null, "default": { "name": "uuid", "args": [ @@ -121,6 +128,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "String", + "nativeType": null, "default": { "name": "uuid", "args": [ @@ -140,6 +148,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "String", + "nativeType": null, "default": { "name": "uuid", "args": [ @@ -159,6 +168,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "String", + "nativeType": null, "default": { "name": "nanoid", "args": [] @@ -176,6 +186,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "String", + "nativeType": null, "default": { "name": "nanoid", "args": [ diff --git a/query-engine/dmmf/test_files/general.json b/query-engine/dmmf/test_files/general.json index 1d5b3c10e8b0..152ab0a2d9b9 100644 --- a/query-engine/dmmf/test_files/general.json +++ b/query-engine/dmmf/test_files/general.json @@ -23,6 +23,7 @@ { "name": "User", "dbName": "user", + "schema": null, "fields": [ { "name": "id", @@ -34,6 +35,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -47,6 +49,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "DateTime", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -60,6 +63,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -74,6 +78,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -87,6 +92,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Post", + "nativeType": null, "relationName": "author", "relationFromFields": [], "relationToFields": [], @@ -103,6 +109,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Profile", + "nativeType": null, "relationName": "ProfileToUser", "relationFromFields": [], "relationToFields": [], @@ -118,6 +125,7 @@ { "name": "Profile", "dbName": "profile", + "schema": null, "fields": [ { "name": "id", @@ -129,6 +137,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -142,6 +151,7 @@ "isReadOnly": true, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -155,6 +165,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "User", + "nativeType": null, "relationName": "ProfileToUser", "relationFromFields": [ "userId" @@ -175,6 +186,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } @@ -187,6 +199,7 @@ { "name": "Post", "dbName": "post", + "schema": null, "fields": [ { "name": "id", @@ -198,6 +211,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -211,6 +225,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "DateTime", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -224,6 +239,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "DateTime", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -237,6 +253,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "String", + "nativeType": null, "default": "Default-Title", "isGenerated": false, "isUpdatedAt": false @@ -251,6 +268,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "Boolean", + "nativeType": null, "default": false, "isGenerated": false, "isUpdatedAt": false @@ -265,6 +283,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "Boolean", + "nativeType": null, "default": false, "isGenerated": false, "isUpdatedAt": false @@ -279,6 +298,7 @@ "isReadOnly": true, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -292,6 +312,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "User", + "nativeType": null, "relationName": "author", "relationFromFields": [ "authorId" @@ -312,6 +333,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "PostToCategory", + "nativeType": null, "relationName": "PostToPostToCategory", "relationFromFields": [], "relationToFields": [], @@ -333,6 +355,7 @@ { "name": "Category", "dbName": "category", + "schema": null, "fields": [ { "name": "id", @@ -344,6 +367,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -357,6 +381,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -370,6 +395,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "PostToCategory", + "nativeType": null, "relationName": "CategoryToPostToCategory", "relationFromFields": [], "relationToFields": [], @@ -386,6 +412,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "CategoryEnum", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } @@ -398,6 +425,7 @@ { "name": "PostToCategory", "dbName": "post_to_category", + "schema": null, "fields": [ { "name": "id", @@ -409,6 +437,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -422,6 +451,7 @@ "isReadOnly": true, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -435,6 +465,7 @@ "isReadOnly": true, "hasDefaultValue": false, "type": "DateTime", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -448,6 +479,7 @@ "isReadOnly": true, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -461,6 +493,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Post", + "nativeType": null, "relationName": "PostToPostToCategory", "relationFromFields": [ "postTitle", @@ -483,6 +516,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Category", + "nativeType": null, "relationName": "CategoryToPostToCategory", "relationFromFields": [ "categoryId" @@ -515,6 +549,7 @@ { "name": "A", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -526,6 +561,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -539,6 +575,7 @@ "isReadOnly": true, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -552,6 +589,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "B", + "nativeType": null, "relationName": "AToB", "relationFromFields": [ "bId" @@ -571,6 +609,7 @@ { "name": "B", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -582,6 +621,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -595,6 +635,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "A", + "nativeType": null, "relationName": "AToB", "relationFromFields": [], "relationToFields": [], @@ -610,6 +651,7 @@ { "name": "NamedCompounds", "dbName": null, + "schema": null, "fields": [ { "name": "a", @@ -621,6 +663,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -634,6 +677,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -647,6 +691,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -660,6 +705,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } @@ -691,6 +737,7 @@ { "name": "MappedSingles", "dbName": null, + "schema": null, "fields": [ { "name": "a", @@ -702,6 +749,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -715,6 +763,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } diff --git a/query-engine/dmmf/test_files/ignore.json b/query-engine/dmmf/test_files/ignore.json index fd48d5f0ff2d..22afd0473cee 100644 --- a/query-engine/dmmf/test_files/ignore.json +++ b/query-engine/dmmf/test_files/ignore.json @@ -4,6 +4,7 @@ { "name": "User", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -15,6 +16,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "Int", + "nativeType": null, "default": { "name": "autoincrement", "args": [] @@ -32,6 +34,7 @@ "isReadOnly": false, "hasDefaultValue": true, "type": "Int", + "nativeType": null, "default": { "name": "dbgenerated", "args": [ diff --git a/query-engine/dmmf/test_files/indexes_mongodb.json b/query-engine/dmmf/test_files/indexes_mongodb.json index 44bc288fb853..b4e055715876 100644 --- a/query-engine/dmmf/test_files/indexes_mongodb.json +++ b/query-engine/dmmf/test_files/indexes_mongodb.json @@ -4,6 +4,7 @@ { "name": "Post", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -16,6 +17,10 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": [ + "ObjectId", + [] + ], "isGenerated": false, "isUpdatedAt": false }, @@ -29,6 +34,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -42,6 +48,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -55,6 +62,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Comment", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } @@ -69,6 +77,7 @@ { "name": "Comment", "dbName": null, + "schema": null, "fields": [ { "name": "userId", @@ -79,7 +88,11 @@ "isId": false, "isReadOnly": false, "hasDefaultValue": false, - "type": "String" + "type": "String", + "nativeType": [ + "ObjectId", + [] + ] }, { "name": "content", @@ -90,7 +103,8 @@ "isId": false, "isReadOnly": false, "hasDefaultValue": false, - "type": "String" + "type": "String", + "nativeType": null } ], "primaryKey": null, diff --git a/query-engine/dmmf/test_files/indexes_mysql.json b/query-engine/dmmf/test_files/indexes_mysql.json index a503a1473fa3..6c7cabd99b35 100644 --- a/query-engine/dmmf/test_files/indexes_mysql.json +++ b/query-engine/dmmf/test_files/indexes_mysql.json @@ -4,6 +4,7 @@ { "name": "Post", "dbName": null, + "schema": null, "fields": [ { "name": "title", @@ -15,6 +16,12 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": [ + "VarChar", + [ + "300" + ] + ], "isGenerated": false, "isUpdatedAt": false }, @@ -28,6 +35,12 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": [ + "VarChar", + [ + "3000" + ] + ], "isGenerated": false, "isUpdatedAt": false }, @@ -41,6 +54,12 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": [ + "VarChar", + [ + "3000" + ] + ], "isGenerated": false, "isUpdatedAt": false }, @@ -54,6 +73,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -67,6 +87,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "DateTime", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } diff --git a/query-engine/dmmf/test_files/indexes_postgres.json b/query-engine/dmmf/test_files/indexes_postgres.json index d07c4cf1e217..e36c3c8c2a5f 100644 --- a/query-engine/dmmf/test_files/indexes_postgres.json +++ b/query-engine/dmmf/test_files/indexes_postgres.json @@ -4,6 +4,7 @@ { "name": "Example", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -15,6 +16,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -28,6 +30,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Json", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } diff --git a/query-engine/dmmf/test_files/indexes_sqlserver.json b/query-engine/dmmf/test_files/indexes_sqlserver.json index 29421158779b..985c3015c959 100644 --- a/query-engine/dmmf/test_files/indexes_sqlserver.json +++ b/query-engine/dmmf/test_files/indexes_sqlserver.json @@ -4,6 +4,7 @@ { "name": "Example", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -15,6 +16,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -28,6 +30,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } @@ -40,6 +43,7 @@ { "name": "Post", "dbName": null, + "schema": null, "fields": [ { "name": "title", @@ -51,6 +55,12 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": [ + "VarChar", + [ + "300" + ] + ], "isGenerated": false, "isUpdatedAt": false }, @@ -64,6 +74,12 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": [ + "VarChar", + [ + "3000" + ] + ], "isGenerated": false, "isUpdatedAt": false }, @@ -77,6 +93,12 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": [ + "VarChar", + [ + "3000" + ] + ], "isGenerated": false, "isUpdatedAt": false }, @@ -90,6 +112,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -103,6 +126,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "DateTime", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } diff --git a/query-engine/dmmf/test_files/schemas.json b/query-engine/dmmf/test_files/schemas.json new file mode 100644 index 000000000000..4248ddc83b48 --- /dev/null +++ b/query-engine/dmmf/test_files/schemas.json @@ -0,0 +1,78 @@ +{ + "enums": [], + "models": [ + { + "name": "A", + "dbName": null, + "schema": "public", + "fields": [ + { + "name": "id", + "kind": "scalar", + "isList": false, + "isRequired": true, + "isUnique": false, + "isId": true, + "isReadOnly": false, + "hasDefaultValue": false, + "type": "Int", + "nativeType": null, + "isGenerated": false, + "isUpdatedAt": false + } + ], + "primaryKey": null, + "uniqueFields": [], + "uniqueIndexes": [], + "isGenerated": false + }, + { + "name": "B", + "dbName": null, + "schema": "test", + "fields": [ + { + "name": "id", + "kind": "scalar", + "isList": false, + "isRequired": true, + "isUnique": false, + "isId": true, + "isReadOnly": false, + "hasDefaultValue": false, + "type": "Int", + "nativeType": null, + "isGenerated": false, + "isUpdatedAt": false + } + ], + "primaryKey": null, + "uniqueFields": [], + "uniqueIndexes": [], + "isGenerated": false + } + ], + "types": [], + "indexes": [ + { + "model": "A", + "type": "id", + "isDefinedOnField": true, + "fields": [ + { + "name": "id" + } + ] + }, + { + "model": "B", + "type": "id", + "isDefinedOnField": true, + "fields": [ + { + "name": "id" + } + ] + } + ] +} \ No newline at end of file diff --git a/query-engine/dmmf/test_files/schemas.prisma b/query-engine/dmmf/test_files/schemas.prisma new file mode 100644 index 000000000000..781dfbe92a0b --- /dev/null +++ b/query-engine/dmmf/test_files/schemas.prisma @@ -0,0 +1,22 @@ +datasource pg { + provider = "postgresql" + url = "postgresql://" + schemas = ["public", "test"] +} + +generator client { + provider = "prisma-client-js" + previewFeatures = ["multiSchema"] +} + +model A { + id Int @id + + @@schema("public") +} + +model B { + id Int @id + + @@schema("test") +} diff --git a/query-engine/dmmf/test_files/source_with_comments.json b/query-engine/dmmf/test_files/source_with_comments.json index 70955715a08e..5c934ddec0cd 100644 --- a/query-engine/dmmf/test_files/source_with_comments.json +++ b/query-engine/dmmf/test_files/source_with_comments.json @@ -4,6 +4,7 @@ { "name": "Author", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -15,6 +16,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -28,6 +30,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false, "documentation": "Name of the author." diff --git a/query-engine/dmmf/test_files/source_with_generator.json b/query-engine/dmmf/test_files/source_with_generator.json index 40c86859a662..e6167f398970 100644 --- a/query-engine/dmmf/test_files/source_with_generator.json +++ b/query-engine/dmmf/test_files/source_with_generator.json @@ -4,6 +4,7 @@ { "name": "Author", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -15,6 +16,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -28,6 +30,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } diff --git a/query-engine/dmmf/test_files/views.json b/query-engine/dmmf/test_files/views.json index ff6de0a05049..7067e66f42cd 100644 --- a/query-engine/dmmf/test_files/views.json +++ b/query-engine/dmmf/test_files/views.json @@ -4,6 +4,7 @@ { "name": "User", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -15,6 +16,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -28,6 +30,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -41,6 +44,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -54,6 +58,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Profile", + "nativeType": null, "relationName": "ProfileToUser", "relationFromFields": [], "relationToFields": [], @@ -69,6 +74,7 @@ { "name": "Profile", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -80,6 +86,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -93,6 +100,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -106,6 +114,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "User", + "nativeType": null, "relationName": "ProfileToUser", "relationFromFields": [ "userId" @@ -126,6 +135,7 @@ "isReadOnly": true, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } @@ -138,6 +148,7 @@ { "name": "UserInfo", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -149,6 +160,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -162,6 +174,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -175,6 +188,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -188,6 +202,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "String", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false } diff --git a/query-engine/dmmf/test_files/without_relation_name.json b/query-engine/dmmf/test_files/without_relation_name.json index 3725937846ea..3d3c8435a784 100644 --- a/query-engine/dmmf/test_files/without_relation_name.json +++ b/query-engine/dmmf/test_files/without_relation_name.json @@ -4,6 +4,7 @@ { "name": "User", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -15,6 +16,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -28,6 +30,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Post", + "nativeType": null, "relationName": "PostToUser", "relationFromFields": [], "relationToFields": [], @@ -43,6 +46,7 @@ { "name": "Post", "dbName": null, + "schema": null, "fields": [ { "name": "id", @@ -54,6 +58,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -67,6 +72,7 @@ "isReadOnly": true, "hasDefaultValue": false, "type": "Int", + "nativeType": null, "isGenerated": false, "isUpdatedAt": false }, @@ -80,6 +86,7 @@ "isReadOnly": false, "hasDefaultValue": false, "type": "User", + "nativeType": null, "relationName": "PostToUser", "relationFromFields": [ "userId"