From 9e53b63601ce12fb7e4c8fdb16d5706ea8609d2f Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Wed, 16 Apr 2008 13:17:03 -0500 Subject: Ignore debug logs and ensure ActiveResource's log is cleaned up. --- activerecord/.gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 activerecord/.gitignore (limited to 'activerecord') diff --git a/activerecord/.gitignore b/activerecord/.gitignore deleted file mode 100644 index 2bf1ef8c0e..0000000000 --- a/activerecord/.gitignore +++ /dev/null @@ -1 +0,0 @@ -debug.log \ No newline at end of file -- cgit v1.2.3 From 82b4faf81218bbd8916ab559590db236c7f80e46 Mon Sep 17 00:00:00 2001 From: Ian White Date: Thu, 17 Apr 2008 13:43:47 -0500 Subject: Fix migrations when migrating to a specified version number with a fresh database [#1 state:resolved] Signed-off-by: Joshua Peek --- activerecord/lib/active_record/migration.rb | 6 ++++-- activerecord/test/cases/migration_test.rb | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 573c6a4f02..1d63bb2f84 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -364,8 +364,10 @@ module ActiveRecord end def current_version - Base.connection.select_values( - "SELECT version FROM #{schema_migrations_table_name}").map(&:to_i).max || 0 + version = Base.connection.select_values( + "SELECT version FROM #{schema_migrations_table_name}" + ).map(&:to_i).max rescue nil + version || 0 end def proper_table_name(name) diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 885d89b6da..c270230d67 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -813,6 +813,13 @@ if ActiveRecord::Base.connection.supports_migrations? end end + def test_migrator_db_has_no_schema_migrations_table + ActiveRecord::Base.connection.execute("DROP TABLE schema_migrations;") + assert_nothing_raised do + ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 1) + end + end + def test_migrator_verbosity ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1) assert PeopleHaveLastNames.message_count > 0 @@ -1010,7 +1017,7 @@ if ActiveRecord::Base.connection.supports_migrations? end end - + uses_mocha 'Sexy migration tests' do class SexyMigrationsTest < ActiveRecord::TestCase def test_references_column_type_adds_id -- cgit v1.2.3