Yohoushi travis rails if running with Rails 2.2.0:
== 20140501115735 AddPathIndexToNodes: migrating ==============================
-- add_index(:nodes, :path, {:length=>255})
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Index name 'index_nodes_on_path' on table 'nodes' already
$ bundle exec rails -v
Rails 4.1.1
$ bundle exec rake db:drop db:create
$ bundle exec rake db:migrate VERSION=20130605091736
$ sqlite3 db/sqlite3
sqlite> .schema nodes
CREATE TABLE "nodes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "path" varchar(768) NOT NULL, "description" varchar(255), "visible" boolean DEFAULT 't' NOT NULL, "complex" boolean, "created_at" datetime, "updated_at" datetime);
=> Index was not created. This is as expected.
$ bundle exec rails -v
Rails 4.2.0
$ bundle exec rake db:drop db:create
$ bundle exec rake db:migrate VERSION=20130605091736
$ sqlite3 db/sqlite3
sqlite> .schema nodes
CREATE TABLE "nodes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar, "path" varchar(768) NOT NULL, "description" varchar, "visible" boolean DEFAULT 't' NOT NULL, "complex" boolean, "created_at" datetime, "updated_at" datetime);
CREATE INDEX "index_nodes_on_path" ON "nodes" ("path");
=> Index was created. This breaks 20140501115735 AddPathIndexToNodes
It seemsindex: true
option of create_table
was fixed in Rails 4.2.0.
http://stackoverflow.com/questions/28199958/does-the-index-option-on-rails-column-migrations-work
I've fixed this problem by yohoushi/yohoushi@cf54a6c.
I've checked the schema after running migration.
4.1.9
mysql
sqlite
4.2.0
mysql
sqlite