diff options
author | Ken Collins <ken@metaskills.net> | 2009-02-09 15:24:59 -0500 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-05-01 14:24:40 +0100 |
commit | b193f233908823cccd2f1d5fcb4146787ed8c4ed (patch) | |
tree | 169b496a2ee97ba01dcf6e51b899ee640a9d4c57 | |
parent | 664ae187a927ba54c8c7ec6eaf9ad89be291fc95 (diff) | |
download | rails-b193f233908823cccd2f1d5fcb4146787ed8c4ed.tar.gz rails-b193f233908823cccd2f1d5fcb4146787ed8c4ed.tar.bz2 rails-b193f233908823cccd2f1d5fcb4146787ed8c4ed.zip |
Use table_exists? in #initialize_schema_migrations_table [#1923 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/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 c29c1562b4..ff63ea3a2e 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) |