Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before reworking
Index
similarly toUniqueConstraint
andForeignKeyConstraint
, I want to introducePrimaryKeyConstraint
. Currently, they are represented as indexes with the "is primary" attribute set totrue
, but there's no such thing as "primary index". On all supported platforms, a primary index is implemented as aPRIMARY KEY
constraint.Besides introducing such a class, I want to provide an upgrade path and implement a new API (e.g.
Table#getPrimaryKeyConstraint()
) which would be state-compatible with the existing API. For instance, a user should be able to create a primary index and then access the primary key constraint.For that, I want to deprecate all invalid states that an index may currently have. The
IndexedColumn
class, particularly, will provide some guarantees for indexed column names and their lengths. Also, it will combine the name and the length together, which should be easier to use.Additionally, even though it currently works correctly, I'm deprecating using nullable columns in a primary index. The reasons are: