Remove unique constraint on attachment name
issue7613 review50531002
This commit is contained in:
1 parent
098ec6d737
commit
e310cfc96a
2 files changed
+5
-11
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Remove unique constraint on attachment name
|
||||
* New icons
|
||||
* Add pyson TimeDelta
|
||||
* Remove button if it is not allowed to access some of its dependant fields
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from sql import Null
|
||||
from sql.operators import Concat
|
||||
|
||||
from ..model import ModelView, ModelSQL, fields, Unique
|
||||
from ..model import ModelView, ModelSQL, fields
|
||||
from ..transaction import Transaction
|
||||
from ..pyson import Eval
|
||||
from .resource import ResourceMixin
|
||||
@@ -51,16 +51,6 @@ class Attachment(ResourceMixin, ModelSQL, ModelView):
|
||||
'invisible': Eval('type') != 'data',
|
||||
}, depends=['type']), 'get_size')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(Attachment, cls).__setup__()
|
||||
table = cls.__table__()
|
||||
cls._sql_constraints += [
|
||||
('resource_name',
|
||||
Unique(table, table.resource, table.name),
|
||||
'The names of attachments must be unique by resource.'),
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
cursor = Transaction().connection.cursor()
|
||||
@@ -86,6 +76,9 @@ class Attachment(ResourceMixin, ModelSQL, ModelView):
|
||||
table.drop_column('digest')
|
||||
table.drop_column('collision')
|
||||
|
||||
# Migration from 4.8: remove unique constraint
|
||||
table.drop_constraint('resource_name')
|
||||
|
||||
@staticmethod
|
||||
def default_type():
|
||||
return 'data'
|
||||
|
||||
Reference in new issue
Block a user