Skip to content

Commit

Permalink
feat: enhance constraint handling by adding support for UNIQUE KEY in…
Browse files Browse the repository at this point in the history
… diagram generation
  • Loading branch information
Kremilly committed Feb 25, 2025
1 parent c9c722d commit 7f04080
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/handlers/diagram_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl DiagramHandlers {
for line in &column_lines {
let line_upper = line.to_uppercase();

if line_upper.starts_with("PRIMARY KEY") || line_upper.starts_with("FOREIGN KEY") || line_upper.starts_with("KEY") || line_upper.starts_with("CONSTRAINT") {
if line_upper.starts_with("PRIMARY KEY") || line_upper.starts_with("FOREIGN KEY") || line_upper.starts_with("KEY") || line_upper.starts_with("UNIQUE KEY") || line_upper.starts_with("CONSTRAINT") {
constraints.push(*line);
continue;
}
Expand Down Expand Up @@ -157,6 +157,8 @@ impl DiagramHandlers {
column.key = Some("FK".to_string());
} else if cons_line_upper.starts_with("KEY") && column.key.is_none() {
column.key = Some("KEY".to_string());
} else if cons_line_upper.starts_with("UNIQUE KEY") {
column.key = Some("UNI".to_string());
}
}
}
Expand Down

0 comments on commit 7f04080

Please sign in to comment.