Skip to content

Commit

Permalink
Fix migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
nikochiko committed Oct 12, 2023
1 parent acc5aea commit a946a33
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app_users/migrations/0007_appuser_is_paying.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

def set_is_paying_from_stripe_customer_id(apps, schema_editor):
AppUsers = apps.get_model("app_users", "appuser")
for user in AppUsers.objects.all():
user.is_paying = bool(user.stripe_customer_id)
user.save()
db_alias = schema_editor.connection.alias
objects = AppUsers.objects.using(db_alias)
objects.exclude(stripe_customer_id="").update(is_paying=True)


class Migration(migrations.Migration):
Expand Down

0 comments on commit a946a33

Please sign in to comment.