Skip to content

Conversation

@Sylphy-Greyrat
Copy link

@openai0229 openai0229 requested a review from Copilot July 10, 2025 14:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for sequence operations (CRUD, DDL export, and SQL generation) across the backend SPI, PostgreSQL plugin, domain services, and the frontend UI.

  • Introduce new Sequence and SimpleSequence models and extend SqlBuilder, MetaData, and DBManage interfaces for sequences.
  • Implement PostgreSQL-specific SQL builder and metadata retrieval for sequences.
  • Wire up new sequence endpoints and UI components (tree context menu, editor, console integration, i18n, typings).

Reviewed Changes

Copilot reviewed 73 out of 73 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
SQLExecutor.java Added generic preExecute helper for querying.
DefaultSqlBuilder.java & SqlBuilder.java Added stub methods for buildCreateSequenceSql and buildModifySequenceSql.
DefaultMetaService.java & PostgreSQLMetaData.java Extended sequence DDL and listing logic.
PostgreSQLSqlBuilder.java Implemented SQL generation for sequences.
Frontend (service/sql.ts, deleteSequence.tsx, SequenceEditor, treeConfig, workspace store, etc.) Hooked up new sequence UI flows and APIs.
Comments suppressed due to low confidence (2)

chat2db-server/chat2db-spi/src/main/java/ai/chat2db/spi/model/SimpleSequence.java:3

  • [nitpick] The class uses SimpleSequence but the SPI interface method is called sequences. Consider consistent naming of methods (simpleSequences) or models to avoid confusion.
import lombok.AllArgsConstructor;

chat2db-client/src/service/sql.ts:62

  • Overloading ITableParams with a capitalized Name prop for sequence operations conflicts with existing tableName usage and backend expectations (sequenceName). Define dedicated request interfaces for sequence endpoints (e.g., ISequenceParams).
}

import ai.chat2db.spi.util.JdbcUtils;
import ai.chat2db.spi.util.ResultSetUtils;
import ai.chat2db.spi.util.SqlUtils;
import cn.hutool.core.collection.CollectionUtil;
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

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

The import of CollectionUtil is unused in this class. Consider removing it to reduce clutter.

Suggested change
import cn.hutool.core.collection.CollectionUtil;

Copilot uses AI. Check for mistakes.
Comment on lines +336 to +341
return null;
}

@Override
public String buildModifySequenceSql(Sequence oldSequence, Sequence newSequence) {
return null;
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

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

Returning null from these stub methods will lead to NPEs when sequence SQL is generated. Either throw UnsupportedOperationException or provide a default implementation.

Suggested change
return null;
}
@Override
public String buildModifySequenceSql(Sequence oldSequence, Sequence newSequence) {
return null;
throw new UnsupportedOperationException("buildCreateSequenceSql is not implemented yet.");
}
@Override
public String buildModifySequenceSql(Sequence oldSequence, Sequence newSequence) {
throw new UnsupportedOperationException("buildModifySequenceSql is not implemented yet.");

Copilot uses AI. Check for mistakes.
dataSourceId: treeNodeData.extraParams.dataSourceId,
databaseName: treeNodeData.extraParams.databaseName,
schemaName: treeNodeData.extraParams.schemaName,
tableName: treeNodeData.name,
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

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

Payload includes both tableName and sequenceName but the service (bound to ITableParams) expects Name or sequenceName. Align the request payload with the service signature or use a dedicated sequence delete interface.

Suggested change
tableName: treeNodeData.name,

Copilot uses AI. Check for mistakes.
@openai0229 openai0229 merged commit 3b67141 into CodePhiliaX:main Jul 10, 2025
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.

3 participants