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

Fix double negative "deactivated" column #2882

Merged
merged 5 commits into from Nov 1, 2019

Conversation

@garrettqmartin8
Copy link
Contributor

garrettqmartin8 commented Oct 30, 2019

Description

Double negatives are confusing, so this PR proposes that we use the word active instead of deactivated to describe whether or not a user is able to log into Milmove. Another PR will be coming to drop the deactivated column so as to follow the zero downtime deploy guidelines.

Reviewer Notes

Dropped a note in context below.

Setup

  • make db_dev_migrate
  • make server_run
  • make client_run
  • Log into the admin app and check that the Active column looks right

Code Review Verification Steps

  • Any new migrations/schema changes:
  • Request review from a member of a different team.
  • Have the Pivotal acceptance criteria been met for this change?

References

@garrettqmartin8 garrettqmartin8 added the ttv label Oct 30, 2019
LastName: "Spaceman",
Email: email,
Role: "SYSTEM_ADMIN",
Deactivated: false,

This comment has been minimized.

Copy link
@garrettqmartin8

garrettqmartin8 Oct 30, 2019

Author Contributor

I removed this line since the value we would have been passing in by default was Active: true, which we would no longer be able to overwrite with the assertions argument. This is due to the fact that mergo will only overwrite fields that contain a zero value of their type (the zero value for bool is false). See more in this issue on the mergo repository, the dependency under the hood of the mergeModels function below.

This makes user setup in a few places a bit more verbose, for example, in pkg/models/user_test.go. Open to ideas for making this better!

This comment has been minimized.

Copy link
@lynzt

lynzt Nov 1, 2019

Contributor

i've run into this too... blah

Copy link
Contributor

lynzt left a comment

Thanks for doing this (and sorry I didn't mention this when I went thru your other pr... it did cross my mind, but didn't say anything)

LGTM - Just a mention about having the active value default to true... thoughts?
Add an index?

(also, dunno if we want to add a "test" user for each table that is deactivated and ensure they have active = false - that's also pretty verbose, so I'm fine w/o this too...)

@@ -0,0 +1,23 @@
ALTER TABLE users
ADD COLUMN active BOOLEAN NOT NULL DEFAULT TRUE;

This comment has been minimized.

Copy link
@lynzt

lynzt Nov 1, 2019

Contributor

I'd probably error on the safe side and default to active=false and force the handler to update this field to true...

Also I assume the active column is used when querying these tables... might want to add an index...

LastName: "Spaceman",
Email: email,
Role: "SYSTEM_ADMIN",
Deactivated: false,

This comment has been minimized.

Copy link
@lynzt

lynzt Nov 1, 2019

Contributor

i've run into this too... blah

Copy link
Contributor

chrisgilmerproj left a comment

I agree with @lynzt . Make those updates and I'm good. Approval in advance here.

@lynzt
lynzt approved these changes Nov 1, 2019
Copy link
Contributor

lynzt left a comment

@garrettqmartin8 I'm approving as to not be a blocker (since i'll be out today and mon), but maybe run your changes by @chrisgilmerproj before merging...

@garrettqmartin8 garrettqmartin8 merged commit 81acf9c into master Nov 1, 2019
16 checks passed
16 checks passed
Summary no rules match, no planned actions
Details
ci/circleci: acceptance_tests_experimental Your tests passed on CircleCI!
Details
ci/circleci: acceptance_tests_local Your tests passed on CircleCI!
Details
ci/circleci: acceptance_tests_staging Your tests passed on CircleCI!
Details
ci/circleci: build_app Your tests passed on CircleCI!
Details
ci/circleci: build_migrations Your tests passed on CircleCI!
Details
ci/circleci: build_storybook_app Your tests passed on CircleCI!
Details
ci/circleci: build_tasks Your tests passed on CircleCI!
Details
ci/circleci: build_tools Your tests passed on CircleCI!
Details
ci/circleci: check_generated_code Your tests passed on CircleCI!
Details
ci/circleci: client_test Your tests passed on CircleCI!
Details
ci/circleci: integration_tests Your tests passed on CircleCI!
Details
ci/circleci: pre_deps_golang Your tests passed on CircleCI!
Details
ci/circleci: pre_deps_yarn Your tests passed on CircleCI!
Details
ci/circleci: pre_test Your tests passed on CircleCI!
Details
ci/circleci: server_test Your tests passed on CircleCI!
Details
@garrettqmartin8 garrettqmartin8 deleted the gm-fix-double-negative branch Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.