From be50bbf71fd35c1810ebe9e3814ef327fef64c2d Mon Sep 17 00:00:00 2001 From: Nikolay Mahotkin Date: Mon, 30 Mar 2015 12:53:10 +0300 Subject: [PATCH] Fixing big type column for output and in_context Closes-Bug: #1438101 Change-Id: I10fe77e4a75aedaeacfd4ea0e9ead87cfe08612d --- mistral/db/sqlalchemy/types.py | 8 ++++++++ mistral/db/v2/sqlalchemy/models.py | 7 ++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mistral/db/sqlalchemy/types.py b/mistral/db/sqlalchemy/types.py index 85acc163..15439849 100644 --- a/mistral/db/sqlalchemy/types.py +++ b/mistral/db/sqlalchemy/types.py @@ -115,3 +115,11 @@ def JsonListType(): def LongText(): # TODO(rakhmerov): Need to do for postgres. return sa.Text().with_variant(mysql.LONGTEXT(), 'mysql') + + +class JsonEncodedLongText(JsonEncoded): + impl = LongText() + + +def JsonLongDictType(): + return MutableDict.as_mutable(JsonEncodedLongText) diff --git a/mistral/db/v2/sqlalchemy/models.py b/mistral/db/v2/sqlalchemy/models.py index 3aebe1ce..276f80ba 100644 --- a/mistral/db/v2/sqlalchemy/models.py +++ b/mistral/db/v2/sqlalchemy/models.py @@ -114,10 +114,7 @@ class ActionExecution(Execution): accepted = sa.Column(sa.Boolean(), default=False) input = sa.Column(st.JsonDictType(), nullable=True) - # Note: Corresponds to MySQL 'LONGTEXT' type which is of unlimited size. - # TODO(rakhmerov): Change to LongText after refactoring. - output = sa.Column(st.JsonDictType(), nullable=True) - # output = sa.orm.deferred(sa.Column(st.LongText(), nullable=True)) + output = sa.orm.deferred(sa.Column(st.JsonLongDictType(), nullable=True)) class WorkflowExecution(ActionExecution): @@ -150,7 +147,7 @@ class TaskExecution(Execution): processed = sa.Column(sa.BOOLEAN, default=False) # Data Flow properties. - in_context = sa.Column(st.JsonDictType()) + in_context = sa.Column(st.JsonLongDictType()) published = sa.Column(st.JsonDictType()) # Runtime context like iteration_no of a repeater.