diff --git a/schema-engine/cli/tests/cli_tests.rs b/schema-engine/cli/tests/cli_tests.rs index 18866f9b1c0a..bec62a2d3a31 100644 --- a/schema-engine/cli/tests/cli_tests.rs +++ b/schema-engine/cli/tests/cli_tests.rs @@ -183,6 +183,17 @@ fn test_create_database_mssql(api: TestApi) { assert!(output.status.success()); } +#[test_connector(tags(Sqlite))] +fn test_sqlite_url(api: TestApi) { + let base_dir = tempfile::tempdir().unwrap(); + let sqlite_path = base_dir.path().join("test.db"); + let url = format!("{}", sqlite_path.to_string_lossy()); + let output = api.run(&["--datasource", &url, "can-connect-to-database"]); + assert!(!output.status.success()); + let message = String::from_utf8(output.stderr).unwrap(); + assert!(message.contains("The provided database string is invalid. The scheme is not recognized in database URL.")); +} + #[test_connector(tags(Sqlite))] fn test_create_sqlite_database(api: TestApi) { let base_dir = tempfile::tempdir().unwrap(); diff --git a/schema-engine/core/src/lib.rs b/schema-engine/core/src/lib.rs index f4288f4305bc..92329a429663 100644 --- a/schema-engine/core/src/lib.rs +++ b/schema-engine/core/src/lib.rs @@ -89,9 +89,7 @@ fn connector_for_connection_string( let connector = MongoDbSchemaConnector::new(params); Ok(Box::new(connector)) } - Some(other) => Err(CoreError::url_parse_error(format!( - "`{other}` is not a known connection URL scheme. Prisma cannot determine the connector." - ))), + Some(_other) => Err(CoreError::url_parse_error("The scheme is not recognized")), None => Err(CoreError::user_facing(InvalidConnectionString { details: String::new(), })),