-
Notifications
You must be signed in to change notification settings - Fork 92
Add support for creating partial indexes on tables #404
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 you 8000 r account
Conversation
Co-authored-by: Ryan Slade <ryanslade@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good 👍
We should also update the read_schema
SQL function to return information about the predicate of a partial index. Right now the new index from the example looks like this:
{
"indexes": {
"idx_fruits_id_gt_10": {
"name": "idx_fruits_id_gt_10",
"unique": false,
"columns": [
"id"
]
}
}
}
(this is part of the resulting_schema
field after the migration to add the partial index has been applied).
The previous version was building the pgroll command before every example run. Instead, build the command once at the beginning and remove it at the end.
Closes xataio#257 --------- Co-authored-by: Andrew Farries <andyrb@gmail.com>
Updated the PR so the output of "idx_fruits_id_gt_10": {
"name": "idx_fruits_id_gt_10",
"unique": false,
"columns": [
"id"
],
"predicate": "(id \u003e 10)"
} |
This PR adds a new option to
create_index
operations calledpredicate
. Whenpredicate
is the conditional expression of the partial index. When it is set, pgroll creates a partial index on the table.Example:
Closes #322