Skip to content

drop foreign key constraint on project_id for release and releasefile#4765

Merged
macqueen merged 5 commits into
masterfrom
drop-project-fks
Jan 13, 2017
Merged

drop foreign key constraint on project_id for release and releasefile#4765
macqueen merged 5 commits into
masterfrom
drop-project-fks

Conversation

@macqueen

Copy link
Copy Markdown
Contributor

#nochanges

@getsentry-bot

getsentry-bot commented Jan 13, 2017

Copy link
Copy Markdown
Contributor
1 Warning
⚠️ Big PR – consider splitting it up into multiple changesets

Generated by 🚫 danger

@mattrobenolt mattrobenolt 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.

if tests pass, should be fine


# Changing field 'ReleaseFile.project_id'
db.execute("ALTER TABLE sentry_releasefile DROP CONSTRAINT project_id_refs_id_878696ea")
elif is_mysql():

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.

From testing locally, it appears that the project_id FK constraints don't exist, so we can ignore anything for MySQL. I confirmed this on both sentry_release and sentry_releasefile.

def forwards(self, orm):
if is_postgres():
# Changing field 'Release.project_id'
db.execute("ALTER TABLE sentry_release DROP CONSTRAINT project_id_refs_id_21d237e2")

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.

Might as well add a IF EXISTS in here so it doesn't error just in case something fishy happened.

ALTER TABLE sentry_release DROP CONSTRAINT IF EXISTS project_id_refs_id_21d237e2

@mattrobenolt mattrobenolt 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.

🥇

@macqueen macqueen merged commit e757e34 into master Jan 13, 2017
@macqueen macqueen deleted the drop-project-fks branch January 13, 2017 20:48
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants