diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 5 | ||||
-rw-r--r-- | activerecord/lib/active_record/schema_dumper.rb | 1 |
2 files changed, 6 insertions, 0 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 ea9173039c..861480d980 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -79,6 +79,11 @@ module ActiveRecord table_definition.primary_key(options[:primary_key] || "id") unless options[:id] == false yield table_definition + + if options[:force] + drop_table(name) rescue nil + end + create_sql = "CREATE#{' TEMPORARY' if options[:temporary]} TABLE " create_sql << "#{name} (" create_sql << table_definition.to_sql diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index 30d6f6927b..f4ce67e9aa 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -53,6 +53,7 @@ HEADER stream.print " create_table #{table.inspect}" stream.print ", :id => false" if !columns.detect { |c| c.name == "id" } + stream.print ", :force => true" stream.puts " do |t|" columns.each do |column| |