Skip to content

Commit

Permalink
Merge pull request #1951 from prisma/describer/postgres-is-identity
Browse files Browse the repository at this point in the history
Parse is_identity more resiliently on postgres
  • Loading branch information
tomhoule committed May 21, 2021
2 parents e55b9c5 + a92f79f commit bd7c464
Show file tree
Hide file tree
Showing 2 changed files with 195 additions and 185 deletions.
11 changes: 5 additions & 6 deletions libs/sql-schema-describer/src/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,11 @@ impl SqlSchemaDescriber {
let table_name = col.get_expect_string("table_name");
let name = col.get_expect_string("column_name");

let is_identity_str = col.get_expect_string("is_identity").to_lowercase();

let is_identity = match is_identity_str.as_str() {
"no" => false,
"yes" => true,
_ => panic!("unrecognized is_identity variant '{}'", is_identity_str),
let is_identity = match col.get_string("is_identity") {
Some(is_id) if is_id.eq_ignore_ascii_case("yes") => true,
Some(is_id) if is_id.eq_ignore_ascii_case("no") => false,
Some(is_identity_str) => panic!("unrecognized is_identity variant '{}'", is_identity_str),
None => false,
};

let data_type = col.get_expect_string("data_type");
Expand Down

0 comments on commit bd7c464

Please sign in to comment.