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

[FEATURE]: Custom Indexes and Tables that encapsulate their migration logic #3871

Open
1 task done
Vinlock opened this issue Dec 30, 2024 · 1 comment
Open
1 task done
Labels
drizzle/kit enhancement New feature or request

Comments

@Vinlock
Copy link

Vinlock commented Dec 30, 2024

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

As a user of Drizzle, I think it would be a valuable enhancement if the index functions—similar to how custom types work—could encapsulate their migration logic. This would make it easier to create and manage migrate-able indexes, particularly for database systems like Vitess, where specialized indexing strategies are required.

For example, Vitess uses unique patterns for managing indexes, which currently requires a lot of manual handling in migrations. If Drizzle provided a way to define indexes with both their type-safe logic and migration steps in one place, it would significantly streamline this process for developers.

Additionally, adding support for custom tables (e.g., Vitess Sequences) could open up even more flexibility. This would allow developers to define reusable, type-safe abstractions for tables that require special handling, while also tying them into the migration framework seamlessly.

This feature could have a broader impact by encouraging the community to contribute their own database-specific solutions, like Vitess-friendly custom indexes or table definitions. These contributions would not only help the community but could also serve as strong candidates for Drizzle’s first-party offerings, enriching the overall ecosystem.

In essence, encapsulating both runtime and migration logic for indexes and custom tables would make Drizzle significantly more powerful for handling advanced use cases while maintaining the elegance of type safety and simplicity it’s known for.


Here are some related feature requests for custom indexes showing the demand. However, this request extends the pattern into custom tables as well.

#3695
#3789
#3790

@Vinlock Vinlock added the enhancement New feature or request label Dec 30, 2024
@dengfuping
Copy link

@Vinlock PR #3790 for customIndex is ready and expected to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
drizzle/kit enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants