The attached patch worked for me on MySQL, although I have no clue if it
will work properly for MSSQL and Oracle users (because I cannot test it).

Jeremy Keiper
OpenMRS Core Developer
AMPATH / IU-Kenya Support


On Fri, Sep 9, 2011 at 1:01 PM, Darius Jazayeri <[email protected]> wrote:

> Moving this to the developers list.
>
> @Saptarshi, does this play into the work you're doing to make us work on
> all databases?
>
> -Darius
>
>
> On Fri, Sep 9, 2011 at 9:57 AM, Jeremy Keiper <[email protected]> wrote:
>
>> Ah, I figured it out.
>>
>> In MySQL, a BLOB column maxes out at 65,535 bytes.  The template property
>> on Form#15 is 67,389 bytes long.  In Oracle, the default size for a blob is
>> (I think) 4GB.  PostgreSQL barely supports BLOB; they use an apparently
>> infinite-length BYTEA.  I guess I should use a <modifySql> block to change
>> BLOB to MEDIUMBLOB for MySQL.
>>
>> Since 1.9 isn't out yet, I assume making this change in the original
>> changeset is okay ... besides, the subsequent changeset will not run
>> properly if a resource is over the size limit.  Right?
>>
>> Jeremy Keiper
>> OpenMRS Core Developer
>> AMPATH / IU-Kenya Support
>>
>>
>> On Thu, Sep 8, 2011 at 4:40 PM, Jeremy Keiper <[email protected]> wrote:
>>
>>> Now I get the same error as Michael:
>>>
>>>
>>>    - Unable to update the database. See server error logs for the full
>>>    stacktrace.
>>>    - There was an error while updating the database to the latest. file:
>>>    liquibase-update-to-latest.xml. Error: Migration failed for change set
>>>    liquibase-update-to-latest.xml::201103152243-b::jkeiper:
>>>    - Reason: liquibase.exception.UnexpectedLiquibaseException:
>>>    liquibase.exception.CustomChangeException: Unable to copy form metadata 
>>> to
>>>    form attributes table:
>>>    - Caused By: liquibase.exception.CustomChangeException: Unable to
>>>    copy form metadata to form attributes table:
>>>    - Caused By: Unable to copy form metadata to form attributes table:
>>>    - Caused By: Data truncation: Data too long for column 'value' at row
>>>    1
>>>
>>>
>>> Jeremy Keiper
>>> OpenMRS Core Developer
>>> AMPATH / IU-Kenya Support
>>>
>>> ------------------------------
> Click here to 
> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from 
> OpenMRS Developers' mailing list

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-devel-l" in the  body (not 
the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]
Index: api/src/main/resources/liquibase-update-to-latest.xml
===================================================================
--- api/src/main/resources/liquibase-update-to-latest.xml	(revision 23241)
+++ api/src/main/resources/liquibase-update-to-latest.xml	(working copy)
@@ -4251,16 +4251,19 @@
 			<column name="name" type="varchar(100)">
 				<constraints nullable="false" />
 			</column>
-			<column name="value" type="blob" />
+			<column name="value" type="blobtype" />
 			<column name="uuid" type="char(38)">
 				<constraints nullable="false"/>
 			</column>
 		</createTable>
		<addUniqueConstraint tableName="form_resource" columnNames="form_id, owner, name"
 			constraintName="form_resource_unique_form_owner_name" />
 		<addForeignKeyConstraint constraintName="form_resource_form"
 			baseTableName="form_resource" baseColumnNames="form_id"
 			referencedTableName="form" referencedColumnNames="form_id" />
+		<modifySql dbms="mysql"><replace replace="blobtype" with="mediumblob"/></modifySql>
+		<modifySql dbms="oracle"><replace replace="blobtype" with="blob"/></modifySql>
+		<modifySql dbms="mssql"><replace replace="blobtype" with="varbinary(16777215)"/></modifySql>
 	</changeSet>
 
 	<changeSet id="201103152243-b" author="jkeiper">

Reply via email to