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

FEATURE: Database - Postgres support in data/repo - Part 1 #371

Merged
merged 26 commits into from
Feb 9, 2025

Conversation

kishorereddy
Copy link
Contributor

@kishorereddy kishorereddy commented Feb 8, 2025

Overview

Support for Postgres in the data/entities components ( PostgresDialect and Repo<TId, T> )

  1. Changes: Actual code changes are fairly isolated/limited
  2. Unit-Tests: Majority of the files changed are actually cleanup/restructuring of unit-tests

Ticket(s)

#370

Links(s)

  1. https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
  2. https://www.postgresql.org/docs/current/datatype.html
  3. https://www.baeldung.com/java-postgresql-store-date-time

Dependencies

  1. Postgres: 14.7
  2. Driver: 42.3.3
  3. JDBC: org.postgresql.Driver

Setup

implementation "org.postgresql:postgresql:42.3.3"

Design

  1. Docker: Updated docker-compose to include mysql and postgres
  2. Install: Updated mysql and postgres install scripts for docker init
  3. Table: Added sample table for tests install/db/mysql/3.x/00-setup-01-unittests.sql
  4. Vendor: Added new enum for Postgres as a vendor
  5. Connection: Fixed connection string loading ( still needs improvement - future )
  6. Dialect: Added new PostGresDialect just like MySqlDialect
  7. Schema: Updated code to support Postgres schema ( Select/Insert/Update/Delete) statements
  8. Tests: Lots of unit-tests reorganized and cleaned up.

Notes

  1. Also added postgres to Docker compose
  2. Some types need to be mapped / named differently ( See below )
bigint          = bigserial ( primary key only )
nvarchar        = varchar
double          = float8
local datetime  = timestamp
zoned datetime  = timestamptz

Pending

  1. Connection: The connection string loading still needs to be further improved in a future PR.
  2. Unit-tests: Some unit-tests still need improvement ( next pr )
  3. Setup: The setup of new model/entity should be simpler ( maybe compatible with Java JPA ).

Tests

Unit-tests have been significantly changed for this PR (but mostly moved and/or renamed )

  1. Package : Tests are now mostly in the data package
  2. SubFolders Tests are further organized into sub-packages under data for db, mapper, query, repo, stmt
  3. Reusable: Tests are reused from base classes, for running same tests against mysql and postgres

@kishorereddy kishorereddy changed the title DATABASE: Support Postgres dialect in data/entities FEATURE: Database - Support Postgres dialect in data/entities Feb 8, 2025
@kishorereddy kishorereddy added priority_high high priority effort_medium medium effort feature new feature request labels Feb 9, 2025
@kishorereddy kishorereddy added the database Database related changes label Feb 9, 2025
@kishorereddy kishorereddy self-assigned this Feb 9, 2025
@kishorereddy kishorereddy changed the title FEATURE: Database - Support Postgres dialect in data/entities FEATURE: Database - Support Postgres dialect in data/repo Feb 9, 2025
@kishorereddy kishorereddy merged commit 10eb42e into main Feb 9, 2025
@kishorereddy kishorereddy changed the title FEATURE: Database - Support Postgres dialect in data/repo FEATURE: Database - Postgres support in data/repo - Part 1 Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Database related changes effort_medium medium effort feature new feature request priority_high high priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant