mirror of https://github.com/jumpserver/jumpserver
Merge pull request #9365 from jumpserver/pr@dev@perf_asset_migration
perf: 优化 k8s migrationspull/9367/head
commit
d8f737c999
|
@ -26,6 +26,7 @@ class Migration(migrations.Migration):
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'unique_together': {('user', 'asset')},
|
'unique_together': {('user', 'asset')},
|
||||||
|
'verbose_name': 'Favorite asset',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -64,7 +64,7 @@ def migrate_cloud_to_asset(apps, *args):
|
||||||
cloud = cloud_model(
|
cloud = cloud_model(
|
||||||
id=app.id, name=app.name,
|
id=app.id, name=app.name,
|
||||||
address=attrs.get('cluster', ''),
|
address=attrs.get('cluster', ''),
|
||||||
protocols='', platform=platform,
|
protocols='k8s/443', platform=platform,
|
||||||
org_id=app.org_id,
|
org_id=app.org_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -88,4 +88,23 @@ class Migration(migrations.Migration):
|
||||||
},
|
},
|
||||||
bases=('assets.assetbaseautomation',),
|
bases=('assets.assetbaseautomation',),
|
||||||
),
|
),
|
||||||
]
|
migrations.AlterField(
|
||||||
|
model_name='automationexecution',
|
||||||
|
name='automation',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='executions', to='assets.baseautomation', verbose_name='Automation task'),
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='baseautomation',
|
||||||
|
unique_together={('org_id', 'name', 'type')},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='asset',
|
||||||
|
options={'ordering': ['name'],
|
||||||
|
'permissions': [('refresh_assethardwareinfo', 'Can refresh asset hardware info'),
|
||||||
|
('test_assetconnectivity', 'Can test asset connectivity'),
|
||||||
|
('push_assetaccount', 'Can push account to asset'),
|
||||||
|
('test_account', 'Can verify account'), ('match_asset', 'Can match asset'),
|
||||||
|
('add_assettonode', 'Add asset to node'),
|
||||||
|
('move_assettonode', 'Move asset to node')], 'verbose_name': 'Asset'},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
# Generated by Django 3.2.16 on 2023-01-05 06:55
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('assets', '0107_automation'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='automationexecution',
|
|
||||||
name='automation',
|
|
||||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='executions', to='assets.baseautomation', verbose_name='Automation task'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,27 +0,0 @@
|
||||||
# Generated by Django 3.2.16 on 2023-01-06 07:07
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('assets', '0108_alter_automationexecution_automation'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='baseautomation',
|
|
||||||
unique_together={('org_id', 'name', 'type')},
|
|
||||||
),
|
|
||||||
migrations.AlterModelOptions(
|
|
||||||
name='asset',
|
|
||||||
options={'ordering': ['name'],
|
|
||||||
'permissions': [('refresh_assethardwareinfo', 'Can refresh asset hardware info'),
|
|
||||||
('test_assetconnectivity', 'Can test asset connectivity'),
|
|
||||||
('push_assetaccount', 'Can push account to asset'),
|
|
||||||
('test_account', 'Can verify account'), ('match_asset', 'Can match asset'),
|
|
||||||
('add_assettonode', 'Add asset to node'),
|
|
||||||
('move_assettonode', 'Move asset to node')], 'verbose_name': 'Asset'},
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,17 +0,0 @@
|
||||||
# Generated by Django 3.2.16 on 2023-01-10 06:45
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('assets', '0109_alter_baseautomation_unique_together'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterModelOptions(
|
|
||||||
name='favoriteasset',
|
|
||||||
options={'verbose_name': 'Favorite Asset'},
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -14,7 +14,7 @@ class FavoriteAsset(JMSBaseModel):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ('user', 'asset')
|
unique_together = ('user', 'asset')
|
||||||
verbose_name = _("Favorite Asset")
|
verbose_name = _("Favorite asset")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_user_favorite_asset_ids(cls, user):
|
def get_user_favorite_asset_ids(cls, user):
|
||||||
|
|
|
@ -6,7 +6,7 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('assets', '0110_alter_favoriteasset_options'),
|
('assets', '0107_automation'),
|
||||||
('tickets', '0028_remove_app_tickets'),
|
('tickets', '0028_remove_app_tickets'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue