-
-
Notifications
You must be signed in to change notification settings - Fork 325
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
Create migrations section #107
Conversation
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.
Tiny and nitpicky change and let's merge it!
@@ -123,6 +123,27 @@ final class User { | |||
|
|||
Here we are deleting the table named `users`. | |||
|
|||
### Preparations as Migrations | |||
|
|||
If you want to add a field to your table after you've already created the initial schema, you can create a struct or class that inherits from `Preparation` like so: |
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.
conforms to
not inherits from
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.
Ah, yes, thank you
|
||
struct AddFooToBar: Preparation { | ||
static func prepare(_ database: Database) throws { | ||
try database.modify("bars", closure: { bar in |
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.
Trailing Swift closure syntax I think would be a little more Swifty here
Sorry saw a notification for this and made a comment without realizing it had already merged |
A little addition the documentation section on Preparations that addresses how to use a Preparation to change an existing db schema.