Skip to content

Commit 22d4ca9

Browse files
committed
Fix LadybugDB schema conflicts by dropping tables before recreation
1 parent f904a27 commit 22d4ca9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/main/java/com/neuvem/java2graph/passes/ExportPass.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,14 @@ private void exportLadybug(Path dbPath, GraphContext context) {
107107
try (Database db = new Database(dbPath.toString());
108108
Connection conn = new Connection(db)) {
109109

110-
// Schema
110+
// Schema - Drop relationship tables first due to dependencies
111+
executeOrThrow(conn, "DROP TABLE IF EXISTS Extends");
112+
executeOrThrow(conn, "DROP TABLE IF EXISTS Implements");
113+
executeOrThrow(conn, "DROP TABLE IF EXISTS Defines");
114+
executeOrThrow(conn, "DROP TABLE IF EXISTS Calls");
115+
executeOrThrow(conn, "DROP TABLE IF EXISTS Class");
116+
executeOrThrow(conn, "DROP TABLE IF EXISTS Method");
117+
111118
executeOrThrow(conn, "CREATE NODE TABLE Class(id STRING, fqn STRING, name STRING, isInterface BOOLEAN, declarationCode STRING, PRIMARY KEY (id))");
112119
executeOrThrow(conn, "CREATE NODE TABLE Method(id STRING, fqn STRING, name STRING, signature STRING, sourceCode STRING, isLambda BOOLEAN, PRIMARY KEY (id))");
113120

0 commit comments

Comments
 (0)