-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introspection Support for Bal Persist #330
Conversation
persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_72/main.bal
Outdated
Show resolved
Hide resolved
persist-cli-tests/src/test/resources/test-src/input/tool_test_pull_14_mysql/script.sql
Outdated
Show resolved
Hide resolved
...sts/src/test/resources/test-src/output/tool_test_generate_72/generated/db/persist_client.bal
Outdated
Show resolved
Hide resolved
persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_86/persist/model.bal
Outdated
Show resolved
Hide resolved
persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_72/persist/model.bal
Show resolved
Hide resolved
65c5f05
to
2e9e825
Compare
…VarChar and Char length, Decimal precision and scale fields
…ce name is not mapped correctly
…ey fields introduced through annotations
…rrectly due to the order in which the entities are organized
} | ||
|
||
public Module introspectDatabase() throws SQLException { | ||
ScriptRunner sr = new ScriptRunner(connection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we close this connection explicitly? Better to have it in a try block for proper resource management.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The connection is instantiated in a try block in Pull.java
persist-cli/src/main/java/io/ballerina/persist/introspect/Introspector.java
Outdated
Show resolved
Hide resolved
persist-cli/src/main/java/io/ballerina/persist/introspect/Introspector.java
Show resolved
Hide resolved
persist-cli/src/main/java/io/ballerina/persist/introspect/MySQLIntrospector.java
Outdated
Show resolved
Hide resolved
persist-cli/src/main/java/io/ballerina/persist/introspectiondto/SQLColumn.java
Outdated
Show resolved
Hide resolved
persist-cli/src/main/java/io/ballerina/persist/introspectiondto/SQLColumn.java
Outdated
Show resolved
Hide resolved
persist-cli/src/main/java/io/ballerina/persist/introspect/MySQLIntrospector.java
Outdated
Show resolved
Hide resolved
persist-cli/src/main/java/io/ballerina/persist/introspectiondto/SQLForeignKey.java
Outdated
Show resolved
Hide resolved
persist-cli/src/main/java/io/ballerina/persist/introspectiondto/SQLIndex.java
Outdated
Show resolved
Hide resolved
persist-cli/src/main/java/io/ballerina/persist/nodegenerator/SourceGenerator.java
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #330 +/- ##
==========================================
+ Coverage 82.43% 82.98% +0.54%
==========================================
Files 45 61 +16
Lines 3992 5241 +1249
Branches 513 665 +152
==========================================
+ Hits 3291 4349 +1058
- Misses 531 675 +144
- Partials 170 217 +47 ☔ View full report in Codecov by Sentry. |
persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_72/Ballerina.toml
Outdated
Show resolved
Hide resolved
persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_75/main.bal
Outdated
Show resolved
Hide resolved
persist-cli-tests/src/test/resources/test-src/input/tool_test_pull_4_mysql/persist/model.bal
Outdated
Show resolved
Hide resolved
persist-cli-tests/src/test/resources/test-src/input/tool_test_pull_5_mysql/persist/model.bal
Outdated
Show resolved
Hide resolved
persist-cli/src/main/resources/cli-help/ballerina-persist-pull.help
Outdated
Show resolved
Hide resolved
persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/BalSyntaxUtils.java
Outdated
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
Purpose
To add introspection support to the
bal persist
module. This introduces a new commandbal persist pull
that will introspect existing SQL databases, generate the data model and write it to thepersist/model.bal
file.Fixes: ballerina-platform/ballerina-library/issues/6014
Checklist