Skip to content

Support extension schema contributors with IndexElement#754

Draft
griffio wants to merge 9 commits into
sqldelight:masterfrom
griffio:support-extension-schema-contributors
Draft

Support extension schema contributors with IndexElement#754
griffio wants to merge 9 commits into
sqldelight:masterfrom
griffio:support-extension-schema-contributors

Conversation

@griffio
Copy link
Copy Markdown
Contributor

@griffio griffio commented Apr 27, 2026

🚧 🏗️ Shows new IndexElement type so that indexes are named types that can be stored in the schema and allow the indexElementName to be overridden.

Introduces an IndexElement type like TableElement as the schema object can then store index names and not specific types like SqlCreateIndexStmt, SqlDropIndexStmt or PostgreSqlAlterIndexStmt.

When PostgreSql dialect implements PostgreSqlAlterIndexStmt it is stored as IndexElement and can replace the existing IndexElement with a new name.

  • Introduces Schema.replace(...), that is public and not inlined, to remove and then add type with a new name.

For the IDEA plugin to work with the new ALTER INDEX mixin, a stub must be created, SqlSchemaContributorImpl is made public similar to SqlCompositeElementImpl.

TODO

  • More testing with SqlDelight as IndexElement must be implemented by dialects and change any calls to schema<SqlCreateIndexStmt> with schema<TableElement>

  • CHANGELOG.md's "Unreleased" section has been updated, if applicable.

griffio added 5 commits April 27, 2026 10:51
similar to TableElement, represents CreateIndex, DropIndex, AlterIndex
Store IndexElement in Schema
Remove name and add new name.
Type is not inlined as has to call private inline functions
Implements IndexElement SchemaContrib
Need to check extension statements for SchemaContrib types that a dialect creates e.g AlterIndex
griffio added 4 commits April 28, 2026 11:03
Allows the index name to be overridden AlterIndex name
Should be SqlTypes.INDEX_NAME not SqlTypes.TABLE_NAME
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