From 7d7aee6cc8961cb0941ead49cc9147d608f26c7e Mon Sep 17 00:00:00 2001 From: Ken Collins Date: Mon, 9 Feb 2009 15:24:59 -0500 Subject: [PATCH] Use table_exists? in #initialize_schema_migrations_table vs hand-rolled tables.detect so that adapter specific implementations can do the leg work of finding out if the schema info/migration tables exists. --- .../abstract/schema_statements.rb | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index c29c156..ff63ea3 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -316,7 +316,7 @@ module ActiveRecord def initialize_schema_migrations_table sm_table = ActiveRecord::Migrator.schema_migrations_table_name - unless tables.detect { |t| t == sm_table } + unless table_exists?(sm_table) create_table(sm_table, :id => false) do |schema_migrations_table| schema_migrations_table.column :version, :string, :null => false end @@ -327,7 +327,7 @@ module ActiveRecord # migrated up to that point: si_table = Base.table_name_prefix + 'schema_info' + Base.table_name_suffix - if tables.detect { |t| t == si_table } + if table_exists?(si_table) old_version = select_value("SELECT version FROM #{quote_table_name(si_table)}").to_i assume_migrated_upto_version(old_version) -- 1.6.1