diff options
author | Jamis Buck <jamis@37signals.com> | 2005-09-23 15:00:56 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2005-09-23 15:00:56 +0000 |
commit | 6d4a4a0d2e0d9f64b7b123dafd3632876356ae3a (patch) | |
tree | 8b94081d29a95e76ca09969506554c14874f77e8 | |
parent | 119855c438812fb60abc51d0ca6ab30f14713941 (diff) | |
download | rails-6d4a4a0d2e0d9f64b7b123dafd3632876356ae3a.tar.gz rails-6d4a4a0d2e0d9f64b7b123dafd3632876356ae3a.tar.bz2 rails-6d4a4a0d2e0d9f64b7b123dafd3632876356ae3a.zip |
Make sqlite adapter pass all tests
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2315 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb | 12 | ||||
-rw-r--r-- | activerecord/test/migration_test.rb | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index 116e20999a..7d2d8986a1 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -166,7 +166,7 @@ module ActiveRecord execute("PRAGMA index_list(#{table_name})", name).map do |row| index = IndexDefinition.new(table_name, row['name']) index.unique = row['unique'] != '0' - index.columns = execute("PRAGMA index_info(#{index.name})").map { |col| col['name'] } + index.columns = execute("PRAGMA index_info('#{index.name}')").map { |col| col['name'] } index end end @@ -188,8 +188,14 @@ module ActiveRecord 'SQLite' end - def remove_index(table_name, column_name) - execute "DROP INDEX #{table_name}_#{column_name}_index" + def remove_index(table_name, options={}) + if Hash === options + index_name = options[:name] + else + index_name = "#{table_name}_#{options}_index" + end + + execute "DROP INDEX #{index_name}" end def add_column(table_name, column_name, type, options = {}) diff --git a/activerecord/test/migration_test.rb b/activerecord/test/migration_test.rb index fa08cf4cf3..502348877c 100644 --- a/activerecord/test/migration_test.rb +++ b/activerecord/test/migration_test.rb @@ -8,6 +8,8 @@ if ActiveRecord::Base.connection.supports_migrations? class Reminder < ActiveRecord::Base; end class MigrationTest < Test::Unit::TestCase + self.use_transactional_fixtures = false + def setup end |