Skip to content
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 kind column to parent_levels_child_levels table #34649

Merged
merged 2 commits into from May 6, 2020

Conversation

davidsbailey
Copy link
Member

@davidsbailey davidsbailey commented May 6, 2020

Follow-on to #34618 (comment)

@davidsbailey davidsbailey changed the title Child level kind migration add kind column to parent_levels_child_levels table May 6, 2020
@davidsbailey davidsbailey mentioned this pull request May 6, 2020
7 tasks
@davidsbailey davidsbailey marked this pull request as ready for review May 6, 2020 18:09
Copy link

@uponthesun uponthesun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume activerecord validations will be responsible for keeping this restricted to specific values.

@@ -0,0 +1,5 @@
class AddKindToParentLevelsChildLevels < ActiveRecord::Migration[5.0]
def change
add_column :parent_levels_child_levels, :kind, :string, null: false, default: 'sublevel'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is default only used because the existing table needs to be backfilled? Just checking for my understanding.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default is so that if you do not specify a value, you'll get a sublevel, rather than a validation error, in the next PR #34650 . the unit tests there attempt to illustrate this

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's slightly better to require a value, but not enough to ask you to change anything. Would be an interesting topic to discuss for next time this comes up, if you feel differently.

@davidsbailey davidsbailey merged commit fc9eec5 into staging May 6, 2020
@davidsbailey davidsbailey deleted the child-level-kind-migration branch May 6, 2020 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants