diff options
author | Josh Susser <josh@hasmanythrough.com> | 2010-03-20 19:46:17 -0700 |
---|---|---|
committer | Josh Susser <josh@hasmanythrough.com> | 2010-12-01 11:01:15 -0800 |
commit | b07c2c0fd3130bb69cf8d846e46762a7c3972107 (patch) | |
tree | 15d8dd984efc7d986d98641bf6a73973c2405ea9 /activerecord/lib | |
parent | 7139aa878ceea8dd17a60955cd4d07f5f68980d9 (diff) | |
download | rails-b07c2c0fd3130bb69cf8d846e46762a7c3972107.tar.gz rails-b07c2c0fd3130bb69cf8d846e46762a7c3972107.tar.bz2 rails-b07c2c0fd3130bb69cf8d846e46762a7c3972107.zip |
clear schema_migrations in Schema.define
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/schema.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/schema_dumper.rb | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/schema.rb b/activerecord/lib/active_record/schema.rb index c9b5539e4f..4b846f2e27 100644 --- a/activerecord/lib/active_record/schema.rb +++ b/activerecord/lib/active_record/schema.rb @@ -46,10 +46,12 @@ module ActiveRecord # ... # end def self.define(info={}, &block) + Base.connection.drop_table(ActiveRecord::Migrator.schema_migrations_table_name) + initialize_schema_migrations_table + schema = new schema.instance_eval(&block) - initialize_schema_migrations_table assume_migrated_upto_version(info[:version], schema.migrations_path) unless info[:version].blank? end diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index a53dce0cf4..794a354917 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -35,12 +35,9 @@ module ActiveRecord def initialize(connection) @connection = connection @types = @connection.native_database_types - @version = Migrator::current_version rescue nil end def header(stream) - define_params = @version ? ":version => #{@version}" : "" - stream.puts <<HEADER # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to @@ -54,7 +51,7 @@ module ActiveRecord # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(#{define_params}) do +ActiveRecord::Schema.define do HEADER end @@ -66,10 +63,11 @@ HEADER def migrations(stream) rows = @connection.select_all("SELECT * FROM #{@connection.quote_table_name(ActiveRecord::Migrator.schema_migrations_table_name)}") rows.each do |migration| - line = %Q(migration "#{migration['version']}") + line = %Q( migration "#{migration['version']}") line << %Q(, "#{migration['name']}") unless migration['name'].blank? stream.puts line end + stream.puts "" end def tables(stream) |