Skip to content

Commit

Permalink
Merge pull request #174 from diogomatoschaves/fix-database-migrations
Browse files Browse the repository at this point in the history
Delete referencing null objects
  • Loading branch information
diogomatoschaves authored Mar 3, 2024
2 parents 5cddd86 + a03c1d8 commit 15becea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions database/model/migrations/0093_auto_20240227_1753.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@
import django.db.models.deletion


def delete_referecing_null(apps, _):
Position = apps.get_model('model', 'Position')

Position.objects.filter(pipeline__id=None).delete()


class Migration(migrations.Migration):

dependencies = [
('model', '0092_run_trade_pnl'),
]

operations = [
migrations.RunPython(delete_referecing_null),
migrations.RemoveField(
model_name='position',
name='exchange',
Expand Down
7 changes: 7 additions & 0 deletions database/model/migrations/0094_auto_20240227_1808.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@
import django.db.models.deletion


def delete_referecing_null(apps, _):
Trade = apps.get_model('model', 'Trade')

Trade.objects.filter(pipeline__id=None).delete()


class Migration(migrations.Migration):

dependencies = [
('model', '0093_auto_20240227_1753'),
]

operations = [
migrations.RunPython(delete_referecing_null),
migrations.RemoveField(
model_name='trade',
name='exchange',
Expand Down

0 comments on commit 15becea

Please sign in to comment.