-
-
Notifications
You must be signed in to change notification settings - Fork 722
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
Creating an index isn't documented in the main readme anymore #1623
Comments
Hello @yspreen, The documentation about the database schema is available at https://swiftpackageindex.com/groue/grdb.swift/documentation/grdb/databaseschema To create indexes, you can use one of the index creation methods, or profit from convenience apis: try db.create(table: "player") { t in
t.autoIncrementedPrimaryKey("id")
// Creates an index or a unique index on the name column.
t.column("name", .text).indexed()
t.column("name", .text).unique()
// Implicitly creates an index of the teamId foreign key.
t.belongsTo("team")
// Creates a unique index of the (a, b) columns.
t.uniqueKey(["a", "b"])
} |
I appreciate the answer. I think it might be beneficial to have a section in the main readme file for creating indexes, since there are sections in that file for querying them. it seems slightly inconsistent |
Do you have anything specific in mind? There are already sections about the schema in the main README. |
I ended up using
because I didn't know the .indexed convenience method was a thing. Might be useful to surface it with some searchable keywords (like "How to create an index") in the main readme. I would've greatly benefited from that! |
…he overview of database schema features Fixes #1623
Hello @yspreen, The overview of the schema features will be restored in the DocC documentation hosted on https://swiftpackageindex.com/groue/GRDB.swift/: #1652. It will bring the indexes overview that you have been missing. |
…he overview of database schema features Fixes #1623
There we are. I restored the overview of possible schema changes at https://swiftpackageindex.com/groue/grdb.swift/v7.0.0-beta.6/documentation/grdb/databaseschemamodifications This won't go in the main README, because DocC is the correct location for an ever-growing documentation. If you think the README should do better for helping people discover this documentation page, please suggest an improvement in a pull request. |
Links like the one in this post are now dead: https://forums.swift.org/t/how-to-add-an-index-for-a-column/48312
Would be nice to have an easily cmd+f'able headline right in the main readme. Other use-cases are explained there, like querying by index, I can't figure out how to create an index though.
The text was updated successfully, but these errors were encountered: