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

ref(crons): Drop last_state_change from db #66429

Merged

Conversation

evanpurkhiser
Copy link
Member

No longer needed after GH-66353

@evanpurkhiser evanpurkhiser requested a review from a team as a code owner March 6, 2024 18:11
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 6, 2024
@evanpurkhiser evanpurkhiser requested review from a team and removed request for a team March 6, 2024 18:12
Copy link
Contributor

github-actions bot commented Mar 6, 2024

This PR has a migration; here is the generated SQL for src/sentry/migrations/0664_monitor_drop_last_state_change_db.py ()

--
-- Custom state/database change combination
--

                ALTER TABLE "sentry_monitorenvironment" DROP COLUMN "last_state_change";

ALTER TABLE "sentry_monitorenvironment" DROP COLUMN "last_state_change";
""",
reverse_sql="""
ALTER TABLE "sentry_monitorenvironment" ADD COLUMN "last_state_change" timestamptz;
Copy link
Member

Choose a reason for hiding this comment

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

Add it as nullable here. Mostly for dev but this reverse will fail otherwise

Copy link
Member Author

Choose a reason for hiding this comment

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

I think default it is nullable without NOT NULL right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Refrence: https://www.postgresql.org/docs/7.3/sql-altertable.html#:~:text=The%20new%20column%20always%20comes,to%20set%20the%20default%20afterwards.

In the current implementation of ADD COLUMN, default and NOT NULL clauses for the new column are not supported. The new column always comes into being with all values NULL. You can use the SET DEFAULT form of ALTER TABLE to set the default afterwards.

right?

Copy link
Member

Choose a reason for hiding this comment

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

I always get this backwards, because in Django it's the opposite!

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.29%. Comparing base (1ca26bc) to head (fdad04d).
Report is 3 commits behind head on master.

❗ Current head fdad04d differs from pull request most recent head 741f92a. Consider uploading reports for the commit 741f92a to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #66429       +/-   ##
===========================================
+ Coverage   57.49%   84.29%   +26.80%     
===========================================
  Files        5292     5309       +17     
  Lines      236552   237233      +681     
  Branches    40959    41042       +83     
===========================================
+ Hits       135999   199974    +63975     
+ Misses     100329    37040    -63289     
+ Partials      224      219        -5     

see 1933 files with indirect coverage changes

Copy link
Contributor

github-actions bot commented Mar 6, 2024

This PR has a migration; here is the generated SQL for src/sentry/migrations/0665_monitor_drop_last_state_change_db.py ()

--
-- Custom state/database change combination
--

                ALTER TABLE "sentry_monitorenvironment" DROP COLUMN "last_state_change";

@evanpurkhiser evanpurkhiser enabled auto-merge (squash) March 6, 2024 19:38
@evanpurkhiser evanpurkhiser merged commit 383367a into master Mar 6, 2024
48 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/ref-crons-drop-last-state-change-from-db branch March 6, 2024 20:00
aliu3ntry pushed a commit that referenced this pull request Mar 6, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants