Browse Source

HUE-9096 [doc] Adding schema migration for link permission

Romain 6 years ago
parent
commit
34ba0fdf62

+ 20 - 0
desktop/core/src/desktop/migrations/0008_auto_20191031_0704.py

@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.20 on 2019-10-31 14:04
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('desktop', '0007_initial'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='defaultconfiguration',
+            name='properties',
+            field=models.TextField(default='[]', help_text='JSON-formatted default properties values.'),
+        ),
+    ]

+ 25 - 0
desktop/core/src/desktop/migrations/0009_auto_20191202_1056.py

@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.20 on 2019-12-02 18:56
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('desktop', '0008_auto_20191031_0704'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='document2permission',
+            name='is_link_on',
+            field=models.BooleanField(default=False),
+        ),
+        migrations.AlterField(
+            model_name='document2permission',
+            name='perms',
+            field=models.CharField(choices=[('read', 'read'), ('write', 'write'), ('comment', 'comment'), ('link_read', 'link read'), ('link_write', 'link write')], db_index=True, default='read', max_length=10),
+        ),
+    ]

+ 2 - 3
desktop/core/src/desktop/models.py

@@ -1558,15 +1558,14 @@ class Document2Permission(models.Model):
   users = models.ManyToManyField(User, db_index=True, db_table='documentpermission2_users')
   groups = models.ManyToManyField(Group, db_index=True, db_table='documentpermission2_groups')
 
-  perms = models.CharField(default=READ_PERM, max_length=10, db_index=True, choices=( # one perm
+  perms = models.CharField(default=READ_PERM, max_length=10, db_index=True, choices=( # One perm
     (READ_PERM, 'read'),
     (WRITE_PERM, 'write'),
-    (COMMENT_PERM, 'comment'),
+    (COMMENT_PERM, 'comment'), # Unused
     (LINK_READ_PERM, 'link read'),
     (LINK_WRITE_PERM, 'link write'),
   ))
 
-  link = models.CharField(default=uuid_default, max_length=255, db_index=True) # unique=True has migration issues
   is_link_on = models.BooleanField(default=False)
 
   class Meta(object):