0

上次我能够成功部署到 Cloud Foundry,现在引入了新的域类,我需要对其进行更新。它更新成功,但是没有创建一个表,这就是为什么我试图删除应用程序并再次推送它以详细查看错误,这就是我得到的:

ERROR hbm2ddl.SchemaUpdate  - Unsuccessful: create table case_file (id bigint not null auto_increment, version bigint not null, case_type varchar(255) not null, category varchar(255) not null, client_id bigint not null, date_created datetime not null, class varchar(255) not null, has_criminal_record bit, house_size decimal(19,2), number_of_children integer, agreement varchar(255), brief_evaluation varchar(4000), comments varchar(4000), court_order varchar(255), date_from datetime, date_of_birth datetime, date_of_report datetime, date_signed_authorized_person datetime, date_signed_revisor datetime, date_to datetime, demand_number varchar(255), first_name varchar(255), has_court_order bit, has_intervention_plan bit, has_voluntary_measures bit, interventions_measure_and_resources varchar(4000), last_name varchar(255), other_documents varchar(255), permanent_code varchar(255), proposed_orientation varchar(4000), results_obtained varchar(4000), signature_of_authorized_person longblob, signature_of_director_of_social_services longblob, signature_of_revisor longblob, situation_of_child varchar(4000), voluntary varchar(255), primary key (id)) ENGINE=InnoDB
2012-06-10 15:17:02,466 [main] ERROR hbm2ddl.SchemaUpdate  - Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
2012-06-10 15:17:02,501 [main] ERROR hbm2ddl.SchemaUpdate  - Unsuccessful: alter table case_file add index FK27F9B12B94D36A39 (client_id), add constraint FK27F9B12B94D36A39 foreign key (client_id) references client (id)
2012-06-10 15:17:02,501 [main] ERROR hbm2ddl.SchemaUpdate  - Table 'd838abcc25b974c87a204aa924e607694.case_file' doesn't exist
2012-06-10 15:17:13,997 [main] ERROR util.JDBCExceptionReporter  - Table 'd838abcc25b974c87a204aa924e607694.case_file' doesn't exist
Stopping Tomcat because the context stopped.

只是为了提供有关该域的一些背景信息,它包含 3 个 longblob(用于图片),我认为这可能会导致“ Row size too large”问题。顺便说一句,我使用的是 grails 2.0.0。我该如何解决这个问题?

该应用程序在本地运行良好,它没有抛出这个错误,这就是为什么我看到它时非常震惊。

4

1 回答 1

2

您可以在他们的网站上阅读 MySQL 中的这个硬限制。基本上,您有很多 256 和 4000 个字符的列,您已经超过了 65,535 个限制。您最好的做法是将varchar(4000)列切换为text

class MyDomain {
    String description

    static mapping = {
        description type: "text"
    }
}

请注意,Hibernate 可能无法将现有数据迁移到新的列类型。先测试一下!并确保在更新之前备份您的 CF 数据库。

于 2012-06-11T13:07:53.060 回答