Skip to content

feat: add auto-increment support to table editor.#10

Merged
dunkbing merged 8 commits into
mainfrom
feat/auto-increment-support
Apr 11, 2026
Merged

feat: add auto-increment support to table editor.#10
dunkbing merged 8 commits into
mainfrom
feat/auto-increment-support

Conversation

@dunkbing
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8a5225f1f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/database/sql_builder.cpp Outdated
Comment on lines +151 to +152
if (col.isPrimaryKey && !inlinePk)
trailingPkColumns.push_back(col.name);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject mixed SQLite AUTOINCREMENT/composite primary keys

When a SQLite table has an auto-increment column plus any additional isPrimaryKey column, this logic still collects the extra PK columns for a trailing PRIMARY KEY (...) clause. createTable() then emits both an inline PRIMARY KEY AUTOINCREMENT and a second table-level primary key, which SQLite rejects, so table creation fails for that valid UI state.

Useful? React with 👍 / 👎.

Comment on lines +1097 to +1100
if (databaseType == DatabaseType::SQLITE && !col.isPrimaryKey) {
errorMessage =
"SQLite AUTOINCREMENT requires '" + col.name + "' to be a PRIMARY KEY";
return false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce MySQL/MariaDB auto-increment key constraints

The new validation only enforces integer types and a SQLite-specific PK rule, but MySQL/MariaDB also require auto-increment columns to be keyed (and effectively limited to one per table). As written, users can mark non-key columns as auto-increment and pass validation, which leads to runtime DDL failures when executing the generated CREATE TABLE SQL.

Useful? React with 👍 / 👎.

@dunkbing dunkbing merged commit 5fdcfde into main Apr 11, 2026
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