Skip to content

Add core entities - #2

Merged
Meet-08 merged 2 commits into
mainfrom
feat/db-setup
Jul 30, 2026
Merged

Add core entities#2
Meet-08 merged 2 commits into
mainfrom
feat/db-setup

Conversation

@Meet-08

@Meet-08 Meet-08 commented Jul 30, 2026

Copy link
Copy Markdown
Owner

This pull request introduces a new schema and supporting entities for managing codebases, repository files, and code chunks, including support for vector embeddings. It also updates dependencies to support these features and makes minor adjustments to the user schema.

Database Schema and Entity Additions

  • Added new entities: Codebase, RepositoryFile, and CodeChunk, including their repositories, to model codebases, files, and code chunks with vector embeddings. (server/src/main/java/com/meet/server/feature/codebase/Codebase.java [1] server/src/main/java/com/meet/server/feature/repositoryfile/RepositoryFile.java [2] server/src/main/java/com/meet/server/feature/codechunk/CodeChunk.java [3] server/src/main/java/com/meet/server/feature/codebase/CodebaseStatus.java [4] server/src/main/java/com/meet/server/feature/repositoryfile/RepositoryFileRepository.java [5] server/src/main/java/com/meet/server/feature/codechunk/CodeChunkRepository.java [6]
  • Added Flyway migration scripts to create the new tables (codebases, repository_files, code_chunks), add vector extension, and update the users table schema. (server/src/main/resources/db/migration/V2__add_schema_for_codebase_and_user_schema_fix.sql [1] server/src/main/resources/db/migration/V3__create_repository_files_and_code_chunks.sql [2]

Dependency Updates

  • Added dependencies for Hibernate vector support and JGit to build.gradle to enable vector embeddings and Git operations. (server/build.gradle [1] [2]

User Schema Fix

  • Changed the User entity to store role and provider as enums and updated the database schema accordingly. (server/src/main/java/com/meet/server/feature/user/User.java [1] server/src/main/resources/db/migration/V2__add_schema_for_codebase_and_user_schema_fix.sql [2]

Summary by CodeRabbit

  • New Features

    • Added support for tracking codebases, including repository details, branches, indexing status, commit information, and timestamps.
    • Added storage for repository files and searchable code chunks, including metadata and embeddings to support future code search capabilities.
    • Added codebase processing states: queued, processing, indexed, and failed.
  • Bug Fixes

    • Improved persistence of user roles to ensure values are stored consistently.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Meet-08, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b375a16b-5b9e-4173-94cc-a11c7672d261

📥 Commits

Reviewing files that changed from the base of the PR and between 5df2e8d and 864d369.

📒 Files selected for processing (4)
  • server/src/main/java/com/meet/server/feature/codebase/Codebase.java
  • server/src/main/java/com/meet/server/feature/codechunk/CodeChunk.java
  • server/src/main/resources/db/migration/V2__add_schema_for_codebase_and_user_schema_fix.sql
  • server/src/main/resources/db/migration/V3__create_repository_files_and_code_chunks.sql
📝 Walkthrough

Walkthrough

Adds JPA entities and repositories for codebases, repository files, and code chunks; introduces codebase statuses and vector embedding persistence; adds PostgreSQL migrations, Hibernate Vector support, JGit, and string persistence for user roles.

Changes

Codebase indexing persistence

Layer / File(s) Summary
Codebase model and schema foundation
server/src/main/java/com/meet/server/feature/codebase/*, server/src/main/java/com/meet/server/feature/user/User.java, server/src/main/resources/db/migration/V2__add_schema_for_codebase_and_user_schema_fix.sql
Adds the Codebase entity and CodebaseStatus values, creates the codebases table with its user foreign key, and stores UserRole as a string.
Repository files and code chunks
server/src/main/java/com/meet/server/feature/repositoryfile/*, server/src/main/java/com/meet/server/feature/codechunk/*, server/src/main/resources/db/migration/V3__create_repository_files_and_code_chunks.sql, server/build.gradle
Adds repository persistence entities and CRUD repositories, creates file/chunk tables with constraints and indexes, enables PostgreSQL vectors, and declares Hibernate Vector and JGit dependencies.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is broadly aligned with the change set, which adds core domain entities and related schema.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/db-setup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@server/src/main/java/com/meet/server/feature/codebase/Codebase.java`:
- Line 41: Store Git commit IDs as text across the codebase: change
Codebase.lastCommitSha from UUID to String, and update
server/src/main/resources/db/migration/V2__add_schema_for_codebase_and_user_schema_fix.sql
at lines 11-11 to define last_commit_sha as VARCHAR(255).

In
`@server/src/main/resources/db/migration/V2__add_schema_for_codebase_and_user_schema_fix.sql`:
- Around line 19-31: Update the users role/provider migration to preserve V1
values: add nullable replacement columns, populate them using explicit ordinal
mappings (role 1/2 to USER/ADMIN and provider 1/2/3 to GOOGLE/GITHUB/EMAIL),
then remove the original SMALLINT columns and retain the mapped columns under
the existing names.

In
`@server/src/main/resources/db/migration/V3__create_repository_files_and_code_chunks.sql`:
- Around line 25-38: Enforce consistent file/codebase ownership across both
affected sites: in
server/src/main/resources/db/migration/V3__create_repository_files_and_code_chunks.sql
lines 25-38, replace the independent ownership foreign keys with a composite
foreign key on (file_id, codebase_id) referencing the corresponding
file/codebase pair; in
server/src/main/java/com/meet/server/feature/codechunk/CodeChunk.java lines
37-43, update the entity mapping so file and codebase associations cannot be set
inconsistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f666c902-2c0a-4861-9f14-cc9d1ffad7e4

📥 Commits

Reviewing files that changed from the base of the PR and between f414920 and 5df2e8d.

📒 Files selected for processing (10)
  • server/build.gradle
  • server/src/main/java/com/meet/server/feature/codebase/Codebase.java
  • server/src/main/java/com/meet/server/feature/codebase/CodebaseStatus.java
  • server/src/main/java/com/meet/server/feature/codechunk/CodeChunk.java
  • server/src/main/java/com/meet/server/feature/codechunk/CodeChunkRepository.java
  • server/src/main/java/com/meet/server/feature/repositoryfile/RepositoryFile.java
  • server/src/main/java/com/meet/server/feature/repositoryfile/RepositoryFileRepository.java
  • server/src/main/java/com/meet/server/feature/user/User.java
  • server/src/main/resources/db/migration/V2__add_schema_for_codebase_and_user_schema_fix.sql
  • server/src/main/resources/db/migration/V3__create_repository_files_and_code_chunks.sql

Comment thread server/src/main/java/com/meet/server/feature/codebase/Codebase.java Outdated
Comment on lines +19 to +31
ALTER TABLE users
DROP
COLUMN provider;

ALTER TABLE users
DROP
COLUMN role;

ALTER TABLE users
ADD provider VARCHAR(255);

ALTER TABLE users
ADD role VARCHAR(255); No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
fd -a '^(UserRole|Provider)\.java$' server/src/main/java
rg -n -C2 'enum\s+(UserRole|Provider)\b' server/src/main/java

Repository: Meet-08/CodeCompass

Length of output: 1154


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== migration files =="
git ls-files 'server/src/main/resources/db/migration/*'

echo
echo "== target migration =="
cat -n server/src/main/resources/db/migration/V2__add_schema_for_codebase_and_user_schema_fix.sql

echo
echo "== related user/provider entity snippets =="
for f in server/src/main/java/com/meet/server/feature/user/UserRole.java server/src/main/java/com/meet/server/feature/auth/Provider.java server/src/main/java/com/meet/server/feature/user/User.java server/src/main/java/com/meet/server/feature/auth/Provider.java; do
  if [ -f "$f" ]; then
    echo "--- $f"
    sed -n '1,180p' "$f" | cat -n
  fi
done

echo
echo "== V1 migration if present =="
fd -a '^V1__.*\.sql$' server/src/main/resources/db/migration || true

Repository: Meet-08/CodeCompass

Length of output: 3681


🏁 Script executed:

#!/bin/bash
set -euo pipefail

cat -n server/src/main/resources/db/migration/V1__initial_schema.sql

echo
echo "== JPA/Hibernate enum mapping config/search =="
rg -n -C2 "`@Enumerated`|EnumType|hibernate|jdbcType|JDBC|Provider|UserRole|role|provider" server/src/main/java server/src/main/resources application*.properties application*.yml application*.yaml server/src/main/resources/db/migration || true

Repository: Meet-08/CodeCompass

Length of output: 16450


Preserve existing role and provider values during conversion.

users.role and users.provider are stored as SMALLINT in V1, but V2 drops and re-adds them as enum string columns, deleting existing values. Add the new columns as nullable, update the existing ordinal rows with the explicit mappings (1 -> USER, 2 -> ADMIN, 1 -> GOOGLE, 2 -> GITHUB, 3 -> EMAIL), then drop the old columns.

🧰 Tools
🪛 Squawk (2.61.0)

[warning] 20-21: Dropping a column may break existing clients.

(ban-drop-column)


[warning] 24-25: Dropping a column may break existing clients.

(ban-drop-column)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@server/src/main/resources/db/migration/V2__add_schema_for_codebase_and_user_schema_fix.sql`
around lines 19 - 31, Update the users role/provider migration to preserve V1
values: add nullable replacement columns, populate them using explicit ordinal
mappings (role 1/2 to USER/ADMIN and provider 1/2/3 to GOOGLE/GITHUB/EMAIL),
then remove the original SMALLINT columns and retain the mapped columns under
the existing names.

Source: Linters/SAST tools

@Meet-08
Meet-08 merged commit dbab9d4 into main Jul 30, 2026
1 check was pending
@Meet-08
Meet-08 deleted the feat/db-setup branch July 30, 2026 15:15
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.

1 participant