aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/schema.rb4
-rw-r--r--activerecord/lib/active_record/schema_dumper.rb8
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)