EngineYard 下 Jruby 的 SQL 语法错误

发布于 2024-12-15 12:10:48 字数 1194 浏览 1 评论 0原文

我在 Jruby 中获得了一些乐趣,但在将我的应用程序部署到 EngineYard 上时遇到了麻烦。在部署下我收到以下错误:

ActiveRecord::JDBCError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(2147483647) DEFAULT NULL' at line 1: ALTER TABLE `iterations` CHANGE `points` `points` longtext(2147483647) DEFAULT NULL

即使我的database.yml使用SQLITE而不是MySQL。迁移文件列为:

class ChangePointsToLongtext < ActiveRecord::Migration
  def up
    change_column :iterations, :points, :longtext
  end

  def down
    change_column :iterations, :points, :text
  end
end

我几乎确定它是 change_column - 我已经尝试过 t.change 并四处寻找其他语法更改。我认为这可能是在 EngineYard 上运行的 Jruby 版本的问题 - 我无法更新。

我的 GemFile 看起来像这样:

platforms :jruby do
 gem 'jruby-openssl'
 gem 'trinidad'
 gem 'activerecord-jdbc-adapter'
gem 'activerecord-jdbcmysql-adapter'
gem 'jdbc-mysql', :require => false
 gem 'jdbc-sqlite3', :require => false
 end

所以我相信我已经加载了所有相关的 gem,以便在 Jruby 下建立数据库,尽管我可能是非常错误的!我想我只需要 change_column 的替代方案

有人遇到过类似的问题吗?或者对改变有什么建议吗?非常感谢任何帮助!

谢谢 C

I am having some fun with Jruby, but I am having troubles getting my app deployed on EngineYard. Under deploy I am getting the follow error:

ActiveRecord::JDBCError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(2147483647) DEFAULT NULL' at line 1: ALTER TABLE `iterations` CHANGE `points` `points` longtext(2147483647) DEFAULT NULL

Even though my database.yml uses SQLITE and not MySQL. The migration file is listed as:

class ChangePointsToLongtext < ActiveRecord::Migration
  def up
    change_column :iterations, :points, :longtext
  end

  def down
    change_column :iterations, :points, :text
  end
end

I am almost certrain its the change_column - I have tried t.change and looked around for other syntax changes. I think it may be an issue with the Jruby version running on EngineYard - which I can't update.

My GemFile looks like this:

platforms :jruby do
 gem 'jruby-openssl'
 gem 'trinidad'
 gem 'activerecord-jdbc-adapter'
gem 'activerecord-jdbcmysql-adapter'
gem 'jdbc-mysql', :require => false
 gem 'jdbc-sqlite3', :require => false
 end

So I believe I have all the relevant gems loaded in order to establish a database under Jruby, although I may be very wrong! I think I just need an alternative to change_column

Has anyone run into a similar problem? Or have any advice on changes? any help is always much appreciated!

Thanks
C

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

逐鹿 2024-12-22 12:10:48

首先,如果您需要有关 Engine 的帮助,请使用 https://support.cloud.engineyard.com/院子。

其次,EY不支持SQLite。当您的应用程序部署到 EY 时,EY 会将 database.yml 替换为适当的信息,以便您的应用程序可以使用环境配置中指示的 DB。设置环境时,数据库选择应默认为 MySQL。

最后,似乎有什么东西生成了不正确的 SQL 语句。看到类似的迁移适用于 MRI 和 mysql2 适配器,问题可能出在 JDBC 适配器上。您可以在 https://github.com/jruby/activerecord-jdbc-adapter 提出问题/issueshttp://bugs.jruby.org

谢谢。

First, please use https://support.cloud.engineyard.com/ if you need help with Engine Yard.

Second, EY does not support SQLite. When your application is deployed to EY, EY will replace database.yml with appropriate information so that your application can use DB indicated in the environment configuration. The DB choice should default to MySQL when you set up your environment.

And finally, it appears that something is generating the incorrect SQL statement. Seeing that a similar migration works with MRI and mysql2 adapter, the issue probably lies with JDBC adapter. You can open an issue at https://github.com/jruby/activerecord-jdbc-adapter/issues or http://bugs.jruby.org.

Thanks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文