##// END OF EJS Templates
db: fixed unique constraints for mysql with it's size limits.
marcink -
r4010:852f3c73 default
parent child Browse files
Show More
@@ -5227,9 +5227,9 b' class FileStore(Base, BaseModel):'
5227 5227 class FileStoreMetadata(Base, BaseModel):
5228 5228 __tablename__ = 'file_store_metadata'
5229 5229 __table_args__ = (
5230 UniqueConstraint('file_store_id', 'file_store_meta_section', 'file_store_meta_key'),
5231 Index('file_store_meta_section_idx', 'file_store_meta_section'),
5232 Index('file_store_meta_key_idx', 'file_store_meta_key'),
5230 UniqueConstraint('file_store_id', 'file_store_meta_section_hash', 'file_store_meta_key_hash'),
5231 Index('file_store_meta_section_idx', 'file_store_meta_section', mysql_length=255),
5232 Index('file_store_meta_key_idx', 'file_store_meta_key', mysql_length=255),
5233 5233 base_table_args
5234 5234 )
5235 5235 SETTINGS_TYPES = {
@@ -5243,14 +5243,19 b' class FileStoreMetadata(Base, BaseModel)'
5243 5243 file_store_meta_id = Column(
5244 5244 "file_store_meta_id", Integer(), nullable=False, unique=True, default=None,
5245 5245 primary_key=True)
5246 file_store_meta_section = Column(
5247 "file_store_meta_section", UnicodeText().with_variant(UnicodeText(1024), 'mysql'),
5246 _file_store_meta_section = Column(
5247 "file_store_meta_section", UnicodeText().with_variant(UnicodeText(1024), 'mysql'),
5248 nullable=True, unique=None, default=None)
5249 _file_store_meta_section_hash = Column(
5250 "file_store_meta_section_hash", String(255),
5248 5251 nullable=True, unique=None, default=None)
5249 file_store_meta_key = Column(
5250 "file_store_meta_key", UnicodeText().with_variant(UnicodeText(1024), 'mysql'),
5252 _file_store_meta_key = Column(
5253 "file_store_meta_key", UnicodeText().with_variant(UnicodeText(1024), 'mysql'),
5251 5254 nullable=True, unique=None, default=None)
5255 _file_store_meta_key_hash = Column(
5256 "file_store_meta_key_hash", String(255), nullable=True, unique=None, default=None)
5252 5257 _file_store_meta_value = Column(
5253 "file_store_meta_value", UnicodeText().with_variant(UnicodeText(20480), 'mysql'),
5258 "file_store_meta_value", UnicodeText().with_variant(UnicodeText(20480), 'mysql'),
5254 5259 nullable=True, unique=None, default=None)
5255 5260 _file_store_meta_value_type = Column(
5256 5261 "file_store_meta_value_type", String(255), nullable=True, unique=None,
@@ -5269,6 +5274,24 b' class FileStoreMetadata(Base, BaseModel)'
5269 5274 'value_type must be one of %s got %s' % (cls.SETTINGS_TYPES.keys(), value))
5270 5275
5271 5276 @hybrid_property
5277 def file_store_meta_section(self):
5278 return self._file_store_meta_section
5279
5280 @file_store_meta_section.setter
5281 def file_store_meta_section(self, value):
5282 self._file_store_meta_section = value
5283 self._file_store_meta_section_hash = _hash_key(value)
5284
5285 @hybrid_property
5286 def file_store_meta_key(self):
5287 return self._file_store_meta_key
5288
5289 @file_store_meta_key.setter
5290 def file_store_meta_key(self, value):
5291 self._file_store_meta_key = value
5292 self._file_store_meta_key_hash = _hash_key(value)
5293
5294 @hybrid_property
5272 5295 def file_store_meta_value(self):
5273 5296 val = self._file_store_meta_value
5274 5297
@@ -5271,9 +5271,9 b' class FileStore(Base, BaseModel):'
5271 5271 class FileStoreMetadata(Base, BaseModel):
5272 5272 __tablename__ = 'file_store_metadata'
5273 5273 __table_args__ = (
5274 UniqueConstraint('file_store_id', 'file_store_meta_section', 'file_store_meta_key'),
5275 Index('file_store_meta_section_idx', 'file_store_meta_section'),
5276 Index('file_store_meta_key_idx', 'file_store_meta_key'),
5274 UniqueConstraint('file_store_id', 'file_store_meta_section_hash', 'file_store_meta_key_hash'),
5275 Index('file_store_meta_section_idx', 'file_store_meta_section', mysql_length=255),
5276 Index('file_store_meta_key_idx', 'file_store_meta_key', mysql_length=255),
5277 5277 base_table_args
5278 5278 )
5279 5279 SETTINGS_TYPES = {
@@ -5287,14 +5287,19 b' class FileStoreMetadata(Base, BaseModel)'
5287 5287 file_store_meta_id = Column(
5288 5288 "file_store_meta_id", Integer(), nullable=False, unique=True, default=None,
5289 5289 primary_key=True)
5290 file_store_meta_section = Column(
5291 "file_store_meta_section", UnicodeText().with_variant(UnicodeText(1024), 'mysql'),
5290 _file_store_meta_section = Column(
5291 "file_store_meta_section", UnicodeText().with_variant(UnicodeText(1024), 'mysql'),
5292 nullable=True, unique=None, default=None)
5293 _file_store_meta_section_hash = Column(
5294 "file_store_meta_section_hash", String(255),
5292 5295 nullable=True, unique=None, default=None)
5293 file_store_meta_key = Column(
5294 "file_store_meta_key", UnicodeText().with_variant(UnicodeText(1024), 'mysql'),
5296 _file_store_meta_key = Column(
5297 "file_store_meta_key", UnicodeText().with_variant(UnicodeText(1024), 'mysql'),
5295 5298 nullable=True, unique=None, default=None)
5299 _file_store_meta_key_hash = Column(
5300 "file_store_meta_key_hash", String(255), nullable=True, unique=None, default=None)
5296 5301 _file_store_meta_value = Column(
5297 "file_store_meta_value", UnicodeText().with_variant(UnicodeText(20480), 'mysql'),
5302 "file_store_meta_value", UnicodeText().with_variant(UnicodeText(20480), 'mysql'),
5298 5303 nullable=True, unique=None, default=None)
5299 5304 _file_store_meta_value_type = Column(
5300 5305 "file_store_meta_value_type", String(255), nullable=True, unique=None,
@@ -5313,6 +5318,24 b' class FileStoreMetadata(Base, BaseModel)'
5313 5318 'value_type must be one of %s got %s' % (cls.SETTINGS_TYPES.keys(), value))
5314 5319
5315 5320 @hybrid_property
5321 def file_store_meta_section(self):
5322 return self._file_store_meta_section
5323
5324 @file_store_meta_section.setter
5325 def file_store_meta_section(self, value):
5326 self._file_store_meta_section = value
5327 self._file_store_meta_section_hash = _hash_key(value)
5328
5329 @hybrid_property
5330 def file_store_meta_key(self):
5331 return self._file_store_meta_key
5332
5333 @file_store_meta_key.setter
5334 def file_store_meta_key(self, value):
5335 self._file_store_meta_key = value
5336 self._file_store_meta_key_hash = _hash_key(value)
5337
5338 @hybrid_property
5316 5339 def file_store_meta_value(self):
5317 5340 val = self._file_store_meta_value
5318 5341
General Comments 0
You need to be logged in to leave comments. Login now