Skip to content

fix(appconnect): Redirect app_id to app_id_str column - #40325

Merged
loewenheim merged 7 commits into
masterfrom
fix/remove-appid-model
Oct 25, 2022
Merged

loewenheim merged 7 commits into
masterfrom
fix/remove-appid-model

Conversation

@loewenheim

Copy link
Copy Markdown
Contributor

This is step 4 in the effort to change the type of AppConnectBuild.app_id from an integer to a string.

It effectively removes the old app_id field and renames the new app_id_str field to app_id.

Depends on #40322.

@wedamija wedamija left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You'll need to generate a migration for this step. Django basically gets confused here because as far as it can tell, you:

  • Deleted app_id_str
  • Changed the type of app_id

Since this pr doesn't make any actual database changes, what you can do is generate the migration, then take the operations it generates and include them in the state_operations of a SeparateDatabaseAndState operation. This allows us to update django's internal migration state, but doesn't result in any actual database operations. There should be a few examples of using SeparateDatabaseAndState in other migrations.

@wedamija wedamija left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just realised - since you're also removing app_id you should mark that column as nullable in either this or a previous migration.

Base automatically changed from fix/use-appid-str to master October 24, 2022 14:57
@loewenheim
loewenheim requested a review from a team as a code owner October 24, 2022 14:57
@loewenheim loewenheim closed this Oct 24, 2022
@loewenheim
loewenheim force-pushed the fix/remove-appid-model branch from 3ceb3ac to 15780e0 Compare October 24, 2022 16:20
@loewenheim loewenheim reopened this Oct 24, 2022
@github-actions

Copy link
Copy Markdown
Contributor

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

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

@loewenheim
loewenheim merged commit bf1323d into master Oct 25, 2022
@loewenheim
loewenheim deleted the fix/remove-appid-model branch October 25, 2022 11:39
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 9, 2022

This branch was successfully deployed

2 active deployments
Preview – storybook — 5103d462 Deployed Oct 25, 2022 by vercel[bot]
Preview – sentry — 5103d462 Deployed Oct 25, 2022 by vercel[bot]
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.

2 participants