Browse Source

Merge pull request #9365 from jumpserver/pr@dev@perf_asset_migration

perf: 优化 k8s migrations
pull/9367/head
老广 2 years ago committed by GitHub
parent
commit
d8f737c999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      apps/assets/migrations/0042_favoriteasset.py
  2. 2
      apps/assets/migrations/0098_auto_20220430_2126.py
  3. 21
      apps/assets/migrations/0107_automation.py
  4. 19
      apps/assets/migrations/0108_alter_automationexecution_automation.py
  5. 27
      apps/assets/migrations/0109_alter_baseautomation_unique_together.py
  6. 17
      apps/assets/migrations/0110_alter_favoriteasset_options.py
  7. 2
      apps/assets/models/favorite_asset.py
  8. 2
      apps/tickets/migrations/0029_auto_20230110_1445.py
  9. 0
      ui/lina/.gitkeep
  10. 0
      ui/luna/.gitkeep

1
apps/assets/migrations/0042_favoriteasset.py

@ -26,6 +26,7 @@ class Migration(migrations.Migration):
],
options={
'unique_together': {('user', 'asset')},
'verbose_name': 'Favorite asset',
},
),
]

2
apps/assets/migrations/0098_auto_20220430_2126.py

@ -64,7 +64,7 @@ def migrate_cloud_to_asset(apps, *args):
cloud = cloud_model(
id=app.id, name=app.name,
address=attrs.get('cluster', ''),
protocols='', platform=platform,
protocols='k8s/443', platform=platform,
org_id=app.org_id,
)

21
apps/assets/migrations/0107_automation.py

@ -88,4 +88,23 @@ class Migration(migrations.Migration):
},
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'},
),
]

19
apps/assets/migrations/0108_alter_automationexecution_automation.py

@ -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'),
),
]

27
apps/assets/migrations/0109_alter_baseautomation_unique_together.py

@ -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'},
),
]

17
apps/assets/migrations/0110_alter_favoriteasset_options.py

@ -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'},
),
]

2
apps/assets/models/favorite_asset.py

@ -14,7 +14,7 @@ class FavoriteAsset(JMSBaseModel):
class Meta:
unique_together = ('user', 'asset')
verbose_name = _("Favorite Asset")
verbose_name = _("Favorite asset")
@classmethod
def get_user_favorite_asset_ids(cls, user):

2
apps/tickets/migrations/0029_auto_20230110_1445.py

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assets', '0110_alter_favoriteasset_options'),
('assets', '0107_automation'),
('tickets', '0028_remove_app_tickets'),
]

0
ui/lina/.gitkeep

0
ui/luna/.gitkeep

Loading…
Cancel
Save