From a3575e31896b9dbdeaf17f8a34727a17a6bd0f8d Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Tue, 9 Sep 2014 10:47:05 +0100 Subject: [PATCH] Changed the storage SQLAlchemy model to use Text The contents property on StoredFiles shouldn't have a length, under MySQL the String type requires a length but Text doesn't and is thus a better fit. Closes-bug: #1365848 Change-Id: Ib91cabe72026d13587d48b4451013d2b3528e96c --- .../sqlalchemy/migrate_repo/versions/002_add_stored_file.py | 4 ++-- tuskar/db/sqlalchemy/models.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tuskar/db/sqlalchemy/migrate_repo/versions/002_add_stored_file.py b/tuskar/db/sqlalchemy/migrate_repo/versions/002_add_stored_file.py index 2e8e5516..fcb1feee 100644 --- a/tuskar/db/sqlalchemy/migrate_repo/versions/002_add_stored_file.py +++ b/tuskar/db/sqlalchemy/migrate_repo/versions/002_add_stored_file.py @@ -11,7 +11,7 @@ # License for the specific language governing permissions and limitations # under the License. -from sqlalchemy import Column, DateTime, Integer, MetaData, String, Table +from sqlalchemy import Column, DateTime, Integer, MetaData, String, Table, Text from tuskar.openstack.common.gettextutils import _ # noqa from tuskar.openstack.common import log as logging @@ -31,7 +31,7 @@ def upgrade(migrate_engine): 'stored_file', meta, Column('uuid', String(length=36), primary_key=True, nullable=False), - Column('contents', String(), nullable=False), + Column('contents', Text(), nullable=False), Column('object_type', String(length=20), nullable=False), Column('name', String(length=64), nullable=True), Column('version', Integer(), nullable=True), diff --git a/tuskar/db/sqlalchemy/models.py b/tuskar/db/sqlalchemy/models.py index 32474079..e212c365 100644 --- a/tuskar/db/sqlalchemy/models.py +++ b/tuskar/db/sqlalchemy/models.py @@ -225,7 +225,7 @@ class StoredFile(Base): uuid = Column(String(length=36), primary_key=True) #: contents contains the full file contents as a string. - contents = Column(String(), nullable=False) + contents = Column(Text(), nullable=False) #: Object type flags the type of file that this is, i.e. template or #: environment file.