Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

Add realm configuration for requiring dates #520

Merged
merged 1 commit into from
Sep 11, 2020

Conversation

sethvargo
Copy link
Member

Fixes GH-519

This adds a new realm-specific configuration for requiring a date. The default is false and backfilled as false.

Release Note

Add realm configuration for requiring a date when generating a verification code. This includes a new `missing_date` error code in the issue API.

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sethvargo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@googlebot googlebot added the cla: yes Auto: added by CLA bot when all committers have signed a CLA. label Sep 10, 2020
@@ -893,6 +893,26 @@ func (db *Database) getMigrations(ctx context.Context) *gormigrate.Gormigrate {
return nil
},
},
{
Copy link
Member Author

Choose a reason for hiding this comment

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

Why not gorm.AutoMigrate? Because you can't set a NOT NULL constraint and DEFAULT at the same time when there are existing rows in the database. Postgres creates them with NULL, then backfills the default... but that violates the NOT NULL constraint. So we have to create the column as nullable, wait for the tx to finish, then mark it as not nullable.

Copy link
Contributor

@whaught whaught left a comment

Choose a reason for hiding this comment

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

Nice - this pr is giving me deja-vu from require MFA

/lgtm

@google-oss-robot google-oss-robot merged commit c332cd9 into main Sep 11, 2020
@google-oss-robot google-oss-robot deleted the sethvargo/require_date branch September 11, 2020 02:37
@google google locked and limited conversation to collaborators Oct 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Auto: added by CLA bot when all committers have signed a CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make a date required for code issue
4 participants