Ticket #11604: add_pk_and_sequence_for_to_sqlite.patch
| File add_pk_and_sequence_for_to_sqlite.patch, 2.1 kB (added by dharding, 2 months ago) |
|---|
-
a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
old new 199 199 index 200 200 end 201 201 end 202 203 def pk_and_sequence_for(table) #:nodoc: 204 return [primary_key(table), nil] 205 end 202 206 203 207 def primary_key(table_name) #:nodoc: 204 208 column = table_structure(table_name).find {|field| field['pk'].to_i == 1} -
a/activerecord/test/cases/schema_dumper_test.rb
old new 103 103 end 104 104 end 105 105 106 if current_adapter?(:SQLiteAdapter) || current_adapter?(:SQLite3Adapter) 107 def test_sqlite_schema_dump_should_honor_nonstandard_primary_keys 108 output = standard_dump 109 match = output.match(%r{create_table "movies"(.*)do}) 110 assert_not_nil(match, "nonstandardpk table not found") 111 assert_match %r(:primary_key => "movieid"), match[1], "non-standard primary key not preserved" 112 end 113 end 114 106 115 if current_adapter?(:MysqlAdapter) 107 116 def test_schema_dump_should_not_add_default_value_for_mysql_text_field 108 117 output = standard_dump