GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
use jruby1.6rc1,rails3.0.1,activerecord-jdbcsqlite3-adapter,in migrate use:
AlsoMigrate error: ActiveRecord::JDBCError: near "LIKE": syntax error:
CREATE TABLE archived_posts LIKE posts;
It seems you need to add parenthesis around the sql "like xxx".
It's related to "also_migrate", see https://github.com/echarp/also_migrate
It seems that:
Putting parens around the like clause allows the migration to proceed, but my schema.rb ends ups with the following comment:
# Could not dump table "archived_apps" because of following StandardError
# Unknown type 'apps' for column 'LIKE'
Looking at the database itself, I see that sqlite is treating LIKE as a column name:
sqlite> select * from sqlite_master where name = 'archived_apps';
select * from sqlite_master where name = 'archived_apps';
table|archived_apps|archived_apps|45|CREATE TABLE archived_apps
(LIKE apps, "deleted_at" datetime)
This problem is not specific to jruby as my development environment is a stock rails 3.0.3 project.
It seems very odd that this projects seems fairly sophisticated and somewhat mature yet fails so miserably out of the box. How could this not work in the default rails dev environment? Seems like I must be missing something.
Any hints would be fabulous.
Looking at the code more closely, I worked around the borked table creation by specifying the :indexes option:
acts_as_archive :indexes => [:id]
which forces the code through a slightly different path to make it work.
Now the migration will actually create the archive tables, but the next problem is that records are deleted from the origin table and never actually created in the archive table.
Hey guys, thanks for looking into this. I am going to look into getting the specs running in SQLite this weekend. If anybody makes it there before me, it would be much appreciated.