Skip to content

Commit

Permalink
Merge branch 'main' into feat/ga-mysql-fulltextsearch-fulltextindex
Browse files Browse the repository at this point in the history
  • Loading branch information
jkomyno authored Nov 21, 2024
2 parents 4c8b364 + 5b155e0 commit 027c45e
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 1 deletion.
22 changes: 22 additions & 0 deletions prisma-fmt/src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,28 @@ mod tests {
use super::*;
use expect_test::expect;

#[test]
fn validate_non_ascii_identifiers() {
let schema = r#"
datasource db {
provider = "postgresql"
url = env("DBURL")
}
model Lööps {
id Int @id
läderlappen Boolean
}
"#;

let request = json!({
"prismaSchema": schema,
});

let response = validate(&request.to_string());
assert!(response.is_ok())
}

#[test]
fn validate_invalid_schema_with_colors() {
let schema = r#"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

enum CatVariant {
lööps
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

model A {
id Int @id @map("_id")
lööps String[]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

model Lööp {
id Int @id
}
4 changes: 3 additions & 1 deletion psl/schema-ast/src/parser/datamodel.pest
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ doc_content = @{ (!NEWLINE ~ ANY)* }
// ######################################
// shared building blocks
// ######################################
identifier = @{ ASCII_ALPHANUMERIC ~ ( "_" | "-" | ASCII_ALPHANUMERIC)* }
unicode_alphanumeric = { LETTER | ASCII_DIGIT }
identifier = @{ unicode_alphanumeric ~ ( "_" | "-" | unicode_alphanumeric)* }
path = @{ identifier ~ ("." ~ path?)* }


WHITESPACE = _{ SPACE_SEPARATOR | "\t" } // tabs are also whitespace
NEWLINE = _{ "\n" | "\r\n" | "\r" }
empty_lines = @{ (WHITESPACE* ~ NEWLINE)+ }
Expand Down

0 comments on commit 027c45e

Please sign in to comment.