perf: 修改 UserAssetGrantedTreeNodeRelation id 为 AutoField

pull/9225/head^2
Bai 2022-12-21 15:16:54 +08:00
parent 3bef582500
commit 5198ac1cc0
3 changed files with 24 additions and 5 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2.14 on 2022-12-21 07:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ops', '0031_auto_20221220_1956'),
]
operations = [
migrations.AlterField(
model_name='historicaljob',
name='created_by',
field=models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by'),
),
migrations.AlterField(
model_name='historicaljob',
name='updated_by',
field=models.CharField(blank=True, max_length=128, null=True, verbose_name='Updated by'),
),
]

View File

@ -41,11 +41,6 @@ class Migration(migrations.Migration):
name='created_by', name='created_by',
field=models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by'), field=models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by'),
), ),
migrations.AlterField(
model_name='userassetgrantedtreenoderelation',
name='id',
field=models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False),
),
migrations.AlterField( migrations.AlterField(
model_name='userassetgrantedtreenoderelation', model_name='userassetgrantedtreenoderelation',
name='updated_by', name='updated_by',

View File

@ -16,6 +16,7 @@ class NodeFrom(TextChoices):
class UserAssetGrantedTreeNodeRelation(FamilyMixin, JMSOrgBaseModel): class UserAssetGrantedTreeNodeRelation(FamilyMixin, JMSOrgBaseModel):
NodeFrom = NodeFrom NodeFrom = NodeFrom
id = models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name=_('ID'))
user = models.ForeignKey('users.User', db_constraint=False, on_delete=models.CASCADE) user = models.ForeignKey('users.User', db_constraint=False, on_delete=models.CASCADE)
node = models.ForeignKey('assets.Node', default=None, on_delete=models.CASCADE, node = models.ForeignKey('assets.Node', default=None, on_delete=models.CASCADE,
db_constraint=False, null=False, related_name='granted_node_rels') db_constraint=False, null=False, related_name='granted_node_rels')