Skip to content

Commit

Permalink
Fixing a potential FK error when doing bulk updates (#606)
Browse files Browse the repository at this point in the history
I hit this upgrade issue in production where the FK for user wasn't
allowing null. Perhaps it is specific to our environment but I'd rather
fix this.
  • Loading branch information
mistercrunch committed Jun 13, 2016
1 parent c58fd63 commit 1a4c7af
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ def upgrade():
bind = op.get_bind()
session = db.Session(bind=bind)

session.query(models.DruidMetric).update({
'is_restricted': False
})
session.query(models.SqlMetric).update({
'is_restricted': False
})
for obj in session.query(models.DruidMetric).all():
obj.is_restricted = False

for obj in session.query(models.SqlMetric).all():
obj.is_restricted = False

session.commit()
session.close()
Expand Down

0 comments on commit 1a4c7af

Please sign in to comment.