diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-08 12:53:13 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-08 12:53:13 +0200 |
commit | c07746cbdfb7b60d2692c9c4a549e4e1b133865f (patch) | |
tree | 392c6e0e368a94e65735e9f3bcf861566132c9fa /activerecord/lib/active_record/schema_dumper.rb | |
parent | dd7ee082be9e53bbee15144b4c03b42a269b154b (diff) | |
parent | 579250ea467ac406a5897dc2187c7959bf343b4f (diff) | |
download | rails-c07746cbdfb7b60d2692c9c4a549e4e1b133865f.tar.gz rails-c07746cbdfb7b60d2692c9c4a549e4e1b133865f.tar.bz2 rails-c07746cbdfb7b60d2692c9c4a549e4e1b133865f.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activerecord/lib/active_record/schema_dumper.rb')
-rw-r--r-- | activerecord/lib/active_record/schema_dumper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index 2d90ef35aa..5d88012e4f 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -78,11 +78,14 @@ HEADER begin tbl = StringIO.new + # first dump primary key column if @connection.respond_to?(:pk_and_sequence_for) pk, pk_seq = @connection.pk_and_sequence_for(table) + elsif @connection.respond_to?(:primary_key) + pk = @connection.primary_key(table) end pk ||= 'id' - + tbl.print " create_table #{table.inspect}" if columns.detect { |c| c.name == pk } if pk != 'id' @@ -94,6 +97,7 @@ HEADER tbl.print ", :force => true" tbl.puts " do |t|" + # then dump all non-primary key columns column_specs = columns.map do |column| raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" if @types[column.type].nil? next if column.name == pk |