-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use only relay to index online status, and update nodestatushistory t…
…o include any type of node rather than linked to provider
- Loading branch information
1 parent
41652f4
commit 8e5a760
Showing
12 changed files
with
283 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...lem-reputation-backend/reputation-backend/api/migrations/0052_update_nodestatushistory.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from django.db import migrations, models | ||
|
||
def update_nodestatushistory(apps, schema_editor): | ||
NodeStatusHistory = apps.get_model('api', 'NodeStatusHistory') | ||
Provider = apps.get_model('api', 'Provider') | ||
|
||
for history in NodeStatusHistory.objects.all(): | ||
if history.provider: | ||
history.node_id = history.provider.node_id | ||
history.save() | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0051_update_gputask_structure'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='nodestatushistory', | ||
name='node_id', | ||
field=models.CharField(max_length=42, null=True), | ||
), | ||
migrations.RunPython(update_nodestatushistory), | ||
migrations.RemoveField( | ||
model_name='nodestatushistory', | ||
name='provider', | ||
), | ||
migrations.AlterField( | ||
model_name='nodestatushistory', | ||
name='node_id', | ||
field=models.CharField(max_length=42), | ||
), | ||
migrations.RemoveIndex( | ||
model_name='nodestatushistory', | ||
name='api_nodesta_provide_94f647_idx', | ||
), | ||
migrations.AddIndex( | ||
model_name='nodestatushistory', | ||
index=models.Index(fields=['node_id', 'timestamp'], name='node_status_history_idx'), | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
...kend/api/migrations/0053_rename_node_status_history_idx_api_nodesta_node_id_acbc40_idx.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.1.7 on 2024-09-19 10:26 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0052_update_nodestatushistory'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameIndex( | ||
model_name='nodestatushistory', | ||
new_name='api_nodesta_node_id_acbc40_idx', | ||
old_name='node_status_history_idx', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.