-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add documentation for modifying schema #6
Conversation
Simple overview of how `db:migrate` works, with a link to a more comprehensive guide from the Rails documentation.
modifying_bety_schema.md
Outdated
In a nutshell, each migration describes a database revision (`up` -- how to make the change) and its inverse (`down` -- how to undo the change). | ||
There are lots of examples of previous migrations in this directory that can be used for reference. | ||
Database operations can be performed by passing SQL queries directly to an `execute %q{<YOUR QUERY HERE>}` statement, or through Ruby helper commands like `change_column`. | ||
Although you can name migrations whatever you want, because they are run in numerical-alphabetical order, the convention is to prefix your script with the current year, month, day, hour, minute, and second (you can generate this string by running `date +%Y%m%d%H%M%S` on the command line). |
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.
another option is that you can use bundle exec rails generate migration ChangeParameterListToText
. This will generate the migration for you with the current datetime.
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.
Didn't know about that, but that's really cool! I'll add it to this.
Thanks for adding this - maybe add some examples, and distinguish editing from adding fields, as well as adding new tables. |
Also, add `generate migration` command.
@robkooper Added the @dlebauer Added a few examples based on existing migrations. Not sure what you mean by "distinguish editing from adding fields, as well as adding new tables". Adding tables and adding, removing, or modifying fields all fall under the |
They are all similar but examples are different.
…On Wed, Feb 7, 2018 at 12:47 PM Rob Kooper ***@***.***> wrote:
***@***.**** approved this pull request.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAcX52EQwmeSKwm8K1MDHgORCYIpRkzqks5tSe10gaJpZM4R8zpT>
.
|
So...is this good to go, or do I need to make further changes? |
Good to go
…On Thu, Feb 8, 2018 at 8:35 AM Alexey Shiklomanov ***@***.***> wrote:
So...is this good to go, or do I need to make further changes?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAcX55fEsh5qhgYH-I9IGS3HMOEUSXfaks5tSwXTgaJpZM4R8zpT>
.
|
Simple overview of how
db:migrate
works, with a link to a morecomprehensive guide from the Rails documentation.