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

Simplify DB override structure to focus on essential features #1194

Merged
merged 3 commits into from
Apr 8, 2025

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Apr 7, 2025

Issue

  • resolve: N/A

Why is this change needed?

This change simplifies the DB override structure to focus only on essential features that are currently needed in the product. The current implementation includes features for adding new columns and relationships that are not required, which leads to AI-based modification proposals suggesting unnecessary changes.

What would you like reviewers to focus on?

  • Confirm that the simplified schema correctly maintains only the three required features (table comments, column comments, table groups)
  • Verify that the removal of unused features (new column addition, new relationship addition) is complete
  • Check if there are any edge cases I might have missed in the applyOverrides function

Testing Verification

Changes have been verified through:

  • Lint checks passing for the modified file
  • Manual review of the schema changes and function implementation

Additional Notes

Co-Authored-By: hirotaka.miyagi@route06.co.jp <hirotaka.miyagi@route06.co.jp>
Copy link

changeset-bot bot commented Apr 7, 2025

⚠️ No Changeset found

Latest commit: f9fe4bd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Apr 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
liam-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 7, 2025 10:36am
liam-erd-sample ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 7, 2025 10:36am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
liam-docs ⬜️ Ignored (Inspect) Visit Preview Apr 7, 2025 10:36am

Copy link

supabase bot commented Apr 7, 2025

Updates to Preview Branch (devin/1744009514-simplify-db-override-structure) ↗︎

Deployments Status Updated
Database Mon, 07 Apr 2025 10:33:51 UTC
Services Mon, 07 Apr 2025 10:33:51 UTC
APIs Mon, 07 Apr 2025 10:33:51 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Mon, 07 Apr 2025 10:33:51 UTC
Migrations Mon, 07 Apr 2025 10:33:52 UTC
Seeding Mon, 07 Apr 2025 10:33:52 UTC
Edge Functions Mon, 07 Apr 2025 10:33:52 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

Co-Authored-By: hirotaka.miyagi@route06.co.jp <hirotaka.miyagi@route06.co.jp>
Copy link
Contributor

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: frontend-ci

Failed stage: Run pnpm test:turbo [❌]

Failed test name: overrideDbStructure

Failure summary:

The action failed because of TypeScript compilation errors in the @liam-hq/db-structure package:

1. There are type errors in src/schema/overrideDbStructure.test.ts where properties like addColumns
and addRelationships are being used but don't exist in the expected type objects:
- Lines 95,
148, 441: Using addColumns when it should be columns
- Lines 221, 272, 297, 320, 343, 366: Using
addRelationships which doesn't exist in the type

2. These TypeScript errors caused the build to fail with exit code 2, which then caused 9 tests to
fail in the overrideDbStructure.test.ts file.

Relevant error logs:
1:  ##[group]Operating System
2:  Ubuntu
...

161:  �[36;1mpnpm install --frozen-lockfile --prefer-offline�[0m
162:  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
163:  env:
164:  PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
165:  ##[endgroup]
166:  Scope: all 16 workspace projects
167:  Lockfile is up to date, resolution step is skipped
168:  Progress: resolved 1, reused 0, downloaded 0, added 0
169:  Packages: +2069
170:  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
171:  Progress: resolved 2069, reused 956, downloaded 0, added 0
172:  Progress: resolved 2069, reused 2041, downloaded 0, added 257
173:  Progress: resolved 2069, reused 2041, downloaded 0, added 839
174:  Progress: resolved 2069, reused 2041, downloaded 0, added 1653
175:  Progress: resolved 2069, reused 2041, downloaded 0, added 2069, done
176:  WARN  Failed to create bin at /home/runner/work/liam/liam/frontend/apps/erd-sample/node_modules/.bin/liam. ENOENT: no such file or directory, open '/home/runner/work/liam/liam/frontend/packages/cli/dist-cli/bin/cli.js'
177:  devDependencies:
178:  + @changesets/cli 2.28.1
179:  + @changesets/get-github-info 0.6.0
180:  + @changesets/types 6.0.0
181:  + @turbo/gen 2.1.2
182:  + syncpack 13.0.3
183:  + turbo 2.1.2
184:  + vercel 41.4.1
185:  frontend/apps/docs postinstall$ fumadocs-mdx
186:  frontend/apps/docs postinstall: [MDX] types generated
187:  frontend/apps/docs postinstall: Done
188:  frontend/apps/app postinstall$ cp ../../packages/db-structure/node_modules/@ruby/prism/src/prism.wasm prism.wasm
189:  frontend/apps/app postinstall: Done
190:  WARN  Failed to create bin at /home/runner/work/liam/liam/frontend/apps/erd-sample/node_modules/.bin/liam. ENOENT: no such file or directory, open '/home/runner/work/liam/liam/frontend/apps/erd-sample/node_modules/@liam-hq/cli/dist-cli/bin/cli.js'
191:  Done in 8.9s
...

917:  ##[endgroup]
918:  ##[group]@liam-hq/erd-core:gen
919:  cache miss, executing 3e1bc04372a1fe96
920:  > @liam-hq/erd-core@0.1.6 gen /home/runner/work/liam/liam/frontend/packages/erd-core
921:  > pnpm run '/^gen:.*/'
922:  > @liam-hq/erd-core@0.1.6 gen:css /home/runner/work/liam/liam/frontend/packages/erd-core
923:  > tcm src
924:  Wrote /home/runner/work/liam/liam/frontend/packages/erd-core/src/styles/variables.css.d.ts
925:  Wrote /home/runner/work/liam/liam/frontend/packages/erd-core/src/styles/globals.css.d.ts
926:  Wrote /home/runner/work/liam/liam/frontend/packages/erd-core/src/features/erd/components/ERDRenderer/ERDRenderer.module.css.d.ts
927:  Wrote /home/runner/work/liam/liam/frontend/packages/erd-core/src/features/erd/components/ERDContent/ERDContent.module.css.d.ts
928:  Wrote /home/runner/work/liam/liam/frontend/packages/erd-core/src/features/erd/components/ERDRenderer/Toolbar/DesktopToolbar.module.css.d.ts
929:  Wrote /home/runner/work/liam/liam/frontend/packages/erd-core/src/features/erd/components/ERDRenderer/TableDetailDrawer/TableDetailDrawer.module.css.d.ts
930:  Wrote /home/runner/work/liam/liam/frontend/packages/erd-core/src/features/erd/components/ERDRenderer/RelationshipEdgeParticleMarker/RelationshipEdgeParticleMarker.module.css.d.ts
931:  Wrote /home/runner/work/liam/liam/frontend/packages/erd-core/src/features/erd/components/ERDRenderer/LeftPane/LeftPane.module.css.d.ts
932:  Wrote /home/runner/work/liam/liam/frontend/packages/erd-core/src/features/erd/components/ERDRenderer/ErrorDisplay/ParseErrorDisplay.module.css.d.ts
933:  Wrote /home/runner/work/liam/liam/frontend/packages/erd-core/src/features/erd/components/ERDRenderer/ErrorDisplay/NetworkErrorDisplay.module.css.d.ts
934:  Wrote /home/runner/work/liam/liam/frontend/packages/erd-core/src/features/erd/components/ERDRenderer/ErrorDisplay/ErrorDisplay.module.css.d.ts
935:  Wrote /home/runner/work/liam/liam/frontend/packages/erd-core/src/features/erd/components/ERDRenderer/CardinalityMarkers/CardinalityMarkers.module.css.d.ts
...

983:  > @liam-hq/cli@0.5.2 gen /home/runner/work/liam/liam/frontend/packages/cli
984:  > pnpm run '/^gen:.*/'
985:  > @liam-hq/cli@0.5.2 gen:css /home/runner/work/liam/liam/frontend/packages/cli
986:  > tcm src
987:  Wrote /home/runner/work/liam/liam/frontend/packages/cli/src/globals.css.d.ts
988:  ##[endgroup]
989:  ##[group]@liam-hq/github:build
990:  cache miss, executing c73f64acd9b0ace6
991:  > @liam-hq/github@0.1.0 build /home/runner/work/liam/liam/frontend/packages/github
992:  > tsc
993:  ##[endgroup]
994:  �[;31m@liam-hq/db-structure:build�[;0m
995:  cache miss, executing 0b737dfc1c098c43
996:  > @liam-hq/db-structure@0.0.17 build /home/runner/work/liam/liam/frontend/packages/db-structure
997:  > tsc && pnpm run cp:prism
998:  ##[error]src/schema/overrideDbStructure.test.ts(95,15): error TS2561: Object literal may only specify known properties, but 'addColumns' does not exist in type '{ comment?: string | null | undefined; columns?: { [x: string]: { comment?: string | null | undefined; }; } | undefined; }'. Did you mean to write 'columns'?
999:  ##[error]src/schema/overrideDbStructure.test.ts(148,15): error TS2561: Object literal may only specify known properties, but 'addColumns' does not exist in type '{ comment?: string | null | undefined; columns?: { [x: string]: { comment?: string | null | undefined; }; } | undefined; }'. Did you mean to write 'columns'?
1000:  ##[error]src/schema/overrideDbStructure.test.ts(221,11): error TS2353: Object literal may only specify known properties, and 'addRelationships' does not exist in type '{ tables?: { [x: string]: { comment?: string | null | undefined; columns?: { [x: string]: { comment?: string | null | undefined; }; } | undefined; }; } | undefined; tableGroups?: { [x: string]: { name: string; tables: string[]; comment: string | null; }; } | undefined; }'.
1001:  ##[error]src/schema/overrideDbStructure.test.ts(272,11): error TS2353: Object literal may only specify known properties, and 'addRelationships' does not exist in type '{ tables?: { [x: string]: { comment?: string | null | undefined; columns?: { [x: string]: { comment?: string | null | undefined; }; } | undefined; }; } | undefined; tableGroups?: { [x: string]: { name: string; tables: string[]; comment: string | null; }; } | undefined; }'.
1002:  ##[error]src/schema/overrideDbStructure.test.ts(297,11): error TS2353: Object literal may only specify known properties, and 'addRelationships' does not exist in type '{ tables?: { [x: string]: { comment?: string | null | undefined; columns?: { [x: string]: { comment?: string | null | undefined; }; } | undefined; }; } | undefined; tableGroups?: { [x: string]: { name: string; tables: string[]; comment: string | null; }; } | undefined; }'.
1003:  ##[error]src/schema/overrideDbStructure.test.ts(320,11): error TS2353: Object literal may only specify known properties, and 'addRelationships' does not exist in type '{ tables?: { [x: string]: { comment?: string | null | undefined; columns?: { [x: string]: { comment?: string | null | undefined; }; } | undefined; }; } | undefined; tableGroups?: { [x: string]: { name: string; tables: string[]; comment: string | null; }; } | undefined; }'.
1004:  ##[error]src/schema/overrideDbStructure.test.ts(343,11): error TS2353: Object literal may only specify known properties, and 'addRelationships' does not exist in type '{ tables?: { [x: string]: { comment?: string | null | undefined; columns?: { [x: string]: { comment?: string | null | undefined; }; } | undefined; }; } | undefined; tableGroups?: { [x: string]: { name: string; tables: string[]; comment: string | null; }; } | undefined; }'.
1005:  ##[error]src/schema/overrideDbStructure.test.ts(366,11): error TS2353: Object literal may only specify known properties, and 'addRelationships' does not exist in type '{ tables?: { [x: string]: { comment?: string | null | undefined; columns?: { [x: string]: { comment?: string | null | undefined; }; } | undefined; }; } | undefined; tableGroups?: { [x: string]: { name: string; tables: string[]; comment: string | null; }; } | undefined; }'.
1006:  ##[error]src/schema/overrideDbStructure.test.ts(441,15): error TS2561: Object literal may only specify known properties, but 'addColumns' does not exist in type '{ comment?: string | null | undefined; columns?: { [x: string]: { comment?: string | null | undefined; }; } | undefined; }'. Did you mean to write 'columns'?
1007:  ELIFECYCLE  Command failed with exit code 2.
1008:  [ERROR] command finished with error: command (/home/runner/work/liam/liam/frontend/packages/db-structure) /home/runner/setup-pnpm/node_modules/.bin/pnpm run build exited (2)
1009:  ##[group]@liam-hq/db-structure:test
1010:  cache miss, executing 5f5089cec67e752e
1011:  > @liam-hq/db-structure@0.0.17 test /home/runner/work/liam/liam/frontend/packages/db-structure
1012:  > vitest --watch=false
1013:  �[1m�[7m�[36m RUN �[39m�[27m�[22m �[36mv3.0.8 �[39m�[90m/home/runner/work/liam/liam/frontend/packages/db-structure�[39m
1014:  �[31m❯�[39m src/schema/overrideDbStructure.test.ts �[2m(�[22m�[2m11 tests�[22m�[2m | �[22m�[31m9 failed�[39m�[2m)�[22m�[90m 84�[2mms�[22m�[39m
1015:  �[32m✓�[39m overrideDbStructure�[2m > �[22mOverriding existing tables�[2m > �[22mshould override a table comment
1016:  �[32m✓�[39m overrideDbStructure�[2m > �[22mOverriding existing tables�[2m > �[22mshould throw an error when overriding a non-existent table
1017:  �[31m   �[31m�[31m overrideDbStructure�[2m > �[22mAdding columns to existing tables�[2m > �[22mshould add new columns to an existing table�[90m 36�[2mms�[22m�[31m�[39m
1018:  �[31m     → expected undefined to be defined�[39m
1019:  �[31m   �[31m�[31m overrideDbStructure�[2m > �[22mAdding columns to existing tables�[2m > �[22mshould throw an error when adding a column that already exists�[90m 6�[2mms�[22m�[31m�[39m
1020:  �[31m     → expected [Function] to throw an error�[39m
1021:  �[31m   �[31m�[31m overrideDbStructure�[2m > �[22mAdding relationships�[2m > �[22mshould add a new relationship�[90m 1�[2mms�[22m�[31m�[39m
1022:  �[31m     → expected undefined to be defined�[39m
1023:  �[31m   �[31m�[31m overrideDbStructure�[2m > �[22mAdding relationships�[2m > �[22mshould throw an error for duplicate relationship names�[90m 1�[2mms�[22m�[31m�[39m
1024:  �[31m     → expected [Function] to throw an error�[39m
1025:  �[31m   �[31m�[31m overrideDbStructure�[2m > �[22mAdding relationships�[2m > �[22mshould throw an error when primary table does not exist�[90m 1�[2mms�[22m�[31m�[39m
1026:  �[31m     → expected [Function] to throw an error�[39m
1027:  �[31m   �[31m�[31m overrideDbStructure�[2m > �[22mAdding relationships�[2m > �[22mshould throw an error when primary column does not exist�[90m 1�[2mms�[22m�[31m�[39m
1028:  �[31m     → expected [Function] to throw an error�[39m
1029:  �[31m   �[31m�[31m overrideDbStructure�[2m > �[22mAdding relationships�[2m > �[22mshould throw an error when foreign table does not exist�[90m 8�[2mms�[22m�[31m�[39m
1030:  �[31m     → expected [Function] to throw an error�[39m
1031:  �[31m   �[31m�[31m overrideDbStructure�[2m > �[22mAdding relationships�[2m > �[22mshould throw an error when foreign column does not exist�[90m 3�[2mms�[22m�[31m�[39m
1032:  �[31m     → expected [Function] to throw an error�[39m
1033:  �[31m   �[31m�[31m overrideDbStructure�[2m > �[22mComplex scenarios�[2m > �[22mshould handle multiple override operations at once�[90m 5�[2mms�[22m�[31m�[39m
1034:  �[31m     → expected undefined to be defined�[39m
1035:  �[32m✓�[39m src/parser/tbls/index.test.ts �[2m(�[22m�[2m16 tests�[22m�[2m)�[22m�[90m 36�[2mms�[22m�[39m
1036:  (node:7608) ExperimentalWarning: WASI is an experimental feature and might change at any time
1037:  (Use `node --trace-warnings ...` to show where the warning was created)
1038:  �[32m✓�[39m src/parser/prisma/index.test.ts �[2m(�[22m�[2m20 tests�[22m�[2m)�[22m�[33m 406�[2mms�[22m�[39m
1039:  �[32m✓�[39m src/parser/schemarb/index.test.ts �[2m(�[22m�[2m18 tests�[22m�[2m)�[22m�[33m 340�[2mms�[22m�[39m
1040:  �[32m✓�[39m src/parser/sql/postgresql/processSQLInChunks.test.ts �[2m(�[22m�[2m6 tests�[22m�[2m)�[22m�[90m 42�[2mms�[22m�[39m
1041:  �[32m✓�[39m src/parser/tbls/schema.generated.test.ts �[2m(�[22m�[2m5 tests�[22m�[2m)�[22m�[90m 47�[2mms�[22m�[39m
1042:  �[32m✓�[39m src/parser/schemarb/singularize.test.ts �[2m(�[22m�[2m18 tests�[22m�[2m)�[22m�[90m 18�[2mms�[22m�[39m
1043:  �[32m✓�[39m src/parser/supportedFormat/detectFormat.test.ts �[2m(�[22m�[2m10 tests�[22m�[2m)�[22m�[90m 12�[2mms�[22m�[39m
1044:  (node:7874) ExperimentalWarning: WASI is an experimental feature and might change at any time
1045:  (Use `node --trace-warnings ...` to show where the warning was created)
1046:  �[32m✓�[39m src/parser/index.test.ts �[2m(�[22m�[2m2 tests�[22m�[2m)�[22m�[90m 249�[2mms�[22m�[39m
1047:  ##[endgroup]
1048:  ##[error]@liam-hq/db-structure#build: command (/home/runner/work/liam/liam/frontend/packages/db-structure) /home/runner/setup-pnpm/node_modules/.bin/pnpm run build exited (2)
1049:  Tasks:    8 successful, 10 total
1050:  Cached:    0 cached, 10 total
1051:  Time:    12.701s 
1052:  Failed:    @liam-hq/db-structure#build
1053:  ERROR  run failed: command  exited (2)
1054:  ELIFECYCLE  Command failed with exit code 2.
1055:  ##[error]Process completed with exit code 2.
1056:  Post job cleanup.

Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add "(aside)" to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Co-Authored-By: hirotaka.miyagi@route06.co.jp <hirotaka.miyagi@route06.co.jp>
Copy link
Member

@MH4GF MH4GF left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing Validation

The simplified code removes validation for table groups that was likely present in the original implementation. Should verify that table groups still have proper validation (e.g., checking if referenced tables exist).

// Process table groups
if (overrides.tableGroups) {

Copy link
Contributor

PR Code Suggestions ✨

No code suggestions found for the PR.

Copy link
Member

@junkisai junkisai left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you for removing the unnecessary features!

@junkisai junkisai added this pull request to the merge queue Apr 8, 2025
Merged via the queue into main with commit b1cb181 Apr 8, 2025
18 checks passed
@junkisai junkisai deleted the devin/1744009514-simplify-db-override-structure branch April 8, 2025 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants