【问题标题】:mysql error:ERROR hbm2ddl.SchemaUpdate - Row size too large when pushing Grails app to Cloud Foundrymysql 错误:错误 hbm2ddl.SchemaUpdate - 将 Grails 应用程序推送到 Cloud Foundry 时行大小太大
【发布时间】:2012-06-10 15:31:04
【问题描述】:

我上次能够成功部署到 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。我该如何解决这个问题?

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

【问题讨论】:

    标签: mysql grails cloud cloud-foundry


    【解决方案1】:

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

    class MyDomain {
        String description
    
        static mapping = {
            description type: "text"
        }
    }
    

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

    【讨论】:

    • 我明白了.. 我确实降低了平均时间的限制。我会试试的。 :D
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-12
    • 1970-01-01
    • 2016-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-18
    相关资源
    最近更新 更多