Skip to content

feat(blueprint): Index section with unique/ASC-DESC dialect support#114

Merged
huyplb merged 3 commits into
mainfrom
cursor/cloud-agent-1785109452769-k0unh
Jul 27, 2026
Merged

feat(blueprint): Index section with unique/ASC-DESC dialect support#114
huyplb merged 3 commits into
mainfrom
cursor/cloud-agent-1785109452769-k0unh

Conversation

@huyplb

@huyplb huyplb commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an Indexes section to the table blueprint modal: add, edit, drop, UNIQUE vs accept-duplicates, per-column ASC/DESC, and optional filtered/partial WHERE.

Dialect research (dialectSupportsIndex)

  • Full create/drop + unique + ASC/DESC: Postgres, Cockroach, Yugabyte, MySQL, MariaDB, TiDB, SQL Server, Azure SQL, Oracle, DB2, SQLite, DuckDB
  • Filtered / partial WHERE: Postgres, Cockroach, Yugabyte, SQL Server, Azure SQL, SQLite
  • No filter: MySQL, MariaDB, TiDB, Oracle, DB2, DuckDB
  • Unsupported indexes: ClickHouse, Redshift
  • SQL Server unique-constraint-backed indexes still round-trip via ALTER TABLE … CONSTRAINT (filters require a UNIQUE INDEX, not a constraint)

Implementation

  • Core bitmatrix + browser export
  • Blueprint SQL: create/drop index; appendFkTriggerSql includes indexes
  • Modal UI between PK and Foreign keys with optional Filter field when filter is supported
  • IndexInfo.filter optional field for future catalog loading

Test plan

  • Unit: dialect-index-support.test.ts, blueprint index SQL (incl. WHERE + unsupported review)
  • cd apps/web && npx tsc --noEmit
Open in Web Open in Cursor 

cursoragent and others added 3 commits July 27, 2026 02:23
Allow add/edit/drop indexes in the table blueprint modal, including ASC/DESC
column order and UNIQUE vs accept-duplicates. ClickHouse and Redshift are
flagged unsupported via dialectSupportsIndex.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
Expose an optional index filter predicate for dialects that support
partial indexes (Postgres family, SQL Server/Azure SQL, SQLite). Other
dialects keep the field hidden and emit -- review: if a filter sneaks in.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
Prepend DROP INDEX/FK/trigger before column alters so DROP COLUMN cannot
run while an index still references the column. Keep replace-edit and
pending remove in sync via replaces, and require confirm/enter when the
catalog has not loaded a partial-index WHERE filter.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
@huyplb
huyplb marked this pull request as ready for review July 27, 2026 03:39
@huyplb
huyplb merged commit ee0fc42 into main Jul 27, 2026
5 of 6 checks passed
@huyplb
huyplb deleted the cursor/cloud-agent-1785109452769-k0unh branch July 27, 2026 03:39
@cursor

cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_11132e1e-e01d-40f7-b29e-30dfe6d3c4e9)

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.

2 participants