Skip to content
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

Add introspection support for PostgreSQL and MSSQL data stores #369

Merged
merged 31 commits into from
May 7, 2024

Conversation

hasathcharu
Copy link
Contributor

@hasathcharu hasathcharu commented May 6, 2024

Purpose

This is to add introspection support for MSSQL and PostgreSQL databases. This PR also contains some bug fixes as well.

Fixes:

Examples

Checklist

  • Linked to an issue
  • Updated the specification
  • Updated the changelog
  • Added tests

hasathcharu added 24 commits May 6, 2024 15:11
This commit refactors the introspect package by moving the database driver resolution logic inside the Introspector class.
Moreover, this also handles the database connection within the Introspector class.
These test cases are not enabled yet. They are created to test the pull command with postgresql.
This commit fixes certain issues with the driver resolution logic and refines the SQL queries used to introspect PostgreSQL databases.
This commit includes the following changes:
- Add test cases for postgresql
- Fix some issues in queries used in postgresql introspection
- This also adds the necessary queries for MSSQL database introspection
This configures MSSQL as a supported datastore for testing introspection support for MSSQL.
This commit fixes an issue where the clients are generated/migrated even if all the entities contain at least one unsupported datatype.
Add test cases to prevent client generation when all entities have unsupported fields
This commit fixes the issue where the unique index is created twice when the field is a one-to-one foreign key.
This was due to the field being marked as 'UNIQUE' and also having a Unique Index created if the foreign key is declared custom through the 'Relation' annotation.
Now, the CLI checks if the foreign key has a unique index created and skips being marked 'UNIQUE' at the column definition.
This commit fixes the issue where when there are more than one association between two entities, the generated script contains the cardinality of the first association for all the associations, ignoring the cardinality of the other associations.
@hasathcharu hasathcharu force-pushed the introspection-mssql branch 2 times, most recently from 593064a to 82efbd0 Compare May 6, 2024 10:36
@hasathcharu hasathcharu force-pushed the introspection-mssql branch from 82efbd0 to 72c2882 Compare May 6, 2024 10:39
@hasathcharu hasathcharu changed the title Introspection mssql Add introspection support for PostgreSQL and MSSQL data stores May 6, 2024
daneshk
daneshk previously approved these changes May 7, 2024
Copy link
Member

@daneshk daneshk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add minor comments. Overall LGTM

Copy link

sonarqubecloud bot commented May 7, 2024

Quality Gate Passed Quality Gate passed

Issues
5 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
1.2% Duplication on New Code

See analysis details on SonarCloud

@daneshk daneshk merged commit c6df8c0 into ballerina-platform:main May 7, 2024
4 checks passed
@hasathcharu hasathcharu deleted the introspection-mssql branch May 8, 2024 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants