Skip to content

Add migration to add data consent boolean, timestamps - #3969

Open
dsubak wants to merge 2 commits into
mainfrom
dansubak/202609_add_data_consent_fields_to_through_model_pt_2
Open

dsubak wants to merge 2 commits into
mainfrom
dansubak/202609_add_data_consent_fields_to_through_model_pt_2

Conversation

@dsubak

@dsubak dsubak commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

https://github.com/mitodl/hq/issues/13262

Description (What does it do?)

This adds the fields we actually care about adding on the b2b contracts m2m through model, namely a boolean tracking data consent and a timestamp for when it was recorded. It also adds row level modification and and created timestamps (technically unnecessary at the moment, could be useful later if we end up adding more fields).

How can this be tested?

Migration should apply without issue. There's no users of this functionality yet, so that's about all that we should expect!

Additional Context

This is a stacked PR on top of the changes that just add the new through model and perform a table rename. I could squish these into one big migration if we'd like, but I think it's nicer to have that separate since the first one is spookier than this one.

Also worth noting is that we have a temporary default created on timestamp specified in the migration. That's because TimestampedModel adds created_on as a non-nullable field. Perfectly reasonable for a net new model, slightly misleading for models which already have records in the table - the practical outcome of this is that all extant records will have the same datetime set. If people don't like that, let me know!

@dsubak
dsubak added this pull request to stack #3970 September 15, 2026 19:08
@github-actions

github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown

OpenAPI Changes

Show/hide changes
## Changes for v0.yaml:
No changes detected

## Changes for v1.yaml:
No changes detected

## Changes for v2.yaml:
No changes detected

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@dsubak
dsubak force-pushed the dansubak/202609_add_data_consent_fields_to_through_model_pt_2 branch from 4706770 to 3e9025b Compare September 15, 2026 19:11
@jkachel jkachel self-assigned this Sep 15, 2026
@dsubak
dsubak force-pushed the dansubak/202609_add_data_consent_fields_to_through_model_pt_2 branch from 3e9025b to e6665d0 Compare September 16, 2026 13:06
@dsubak
dsubak force-pushed the dansubak/202609_add_data_consent_fields_to_through_model_pt_2 branch from e6665d0 to e09a539 Compare September 17, 2026 18:45
@dsubak
dsubak force-pushed the dansubak/202609_add_data_consent_fields_to_through_model_pt_2 branch from e09a539 to b8e54d3 Compare September 17, 2026 20:44
@dsubak
dsubak force-pushed the dansubak/202609_add_data_consent_fields_to_through_model_pt_2 branch from b8e54d3 to 5a0ac54 Compare September 18, 2026 20:48

@jkachel jkachel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small change - should be good to go once that's fixed, though.

Comment thread b2b/migrations/0030_userb2bcontract_consent_modified_at_and_more.py
@dsubak
dsubak force-pushed the dansubak/202609_add_data_consent_fields_to_through_model_pt_2 branch from 5a0ac54 to fb2dcf8 Compare September 22, 2026 13:06

@jkachel jkachel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍 did test on an instance that didn't have the pt1 migrations applied yet

@dsubak
dsubak force-pushed the dansubak/202609_add_data_consent_fields_to_through_model_pt_2 branch from 0cb739f to 802cded Compare September 23, 2026 13:41
Base automatically changed from dansubak/202609_add_data_consent_fields_to_through_model to main September 23, 2026 13:51
@dsubak
dsubak force-pushed the dansubak/202609_add_data_consent_fields_to_through_model_pt_2 branch from 802cded to 239258e Compare September 23, 2026 13:51
@dsubak
dsubak force-pushed the dansubak/202609_add_data_consent_fields_to_through_model_pt_2 branch from 239258e to fd4c9f9 Compare September 23, 2026 21:13

This branch has not been deployed

No deployments
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.

2 participants