Changeset 8324
- Timestamp:
- 12/06/07 18:57:19 (2 years ago)
- Files:
-
- trunk/activerecord/lib/active_record/migration.rb (modified) (1 diff)
- trunk/railties/CHANGELOG (modified) (1 diff)
- trunk/railties/lib/tasks/databases.rake (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/lib/active_record/migration.rb
r8129 r8324 351 351 end 352 352 353 def pending_migrations 354 migration_classes.select { |m| m.version > current_version } 355 end 356 353 357 private 354 358 def migration_classes trunk/railties/CHANGELOG
r8321 r8324 1 1 *2.0.0* (December 6th, 2007) 2 3 * The test task stops with a warning if you have pending migrations. #10377 [Josh Knowles] 2 4 3 5 * Add warning to documentation about using transactional fixtures when the code under test uses transactions itself. Closes #7548 [thijsv] trunk/railties/lib/tasks/databases.rake
r8248 r8324 124 124 task :version => :environment do 125 125 puts "Current version: #{ActiveRecord::Migrator.current_version}" 126 end 127 128 desc "Raises an error if there are pending migrations" 129 task :abort_if_pending_migrations => :environment do 130 pending_migrations = ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations 131 132 if pending_migrations.any? 133 puts "You have #{pending_migrations.size} pending migrations:" 134 pending_migrations.each do |pending_migration| 135 puts ' %4d %s' % [pending_migration.version, pending_migration.name] 136 end 137 abort "Run `rake db:migrate` to update your database then try again." 138 end 126 139 end 127 140 … … 291 304 292 305 desc 'Prepare the test database and load the schema' 293 task :prepare => :environmentdo306 task :prepare => %w(environment db:abort_if_pending_migrations) do 294 307 if defined?(ActiveRecord::Base) && !ActiveRecord::Base.configurations.blank? 295 308 Rake::Task[{ :sql => "db:test:clone_structure", :ruby => "db:test:clone" }[ActiveRecord::Base.schema_format]].invoke