diff options
author | Hongli Lai (Phusion) <hongli@phusion.nl> | 2009-07-05 09:59:25 +0200 |
---|---|---|
committer | Yehuda Katz <wycats@yehuda-katzs-macbookpro41.local> | 2009-07-07 16:17:25 -0700 |
commit | 187d90f7529e02c3c863e6b68b45d8e34f315140 (patch) | |
tree | 2e888155ab463ea6dda8824bae923c0598ca945d /activerecord/test | |
parent | 1e2d7229602f467cfdc0ef606b5ef8a5566a1501 (diff) | |
download | rails-187d90f7529e02c3c863e6b68b45d8e34f315140.tar.gz rails-187d90f7529e02c3c863e6b68b45d8e34f315140.tar.bz2 rails-187d90f7529e02c3c863e6b68b45d8e34f315140.zip |
Add support for dumping non-standard primary keys when using the SQLite3 adapter. Fix unit tests so that this feature is tested for all adapters. [#2868 state:resolved]
Signed-off-by: Yehuda Katz <wycats@yehuda-katzs-macbookpro41.local>
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/schema_dumper_test.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index 4f02be3c06..9612b0beb6 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -156,6 +156,13 @@ class SchemaDumperTest < ActiveRecord::TestCase index_definition = standard_dump.split(/\n/).grep(/add_index.*companies/).first.strip assert_equal 'add_index "companies", ["firm_id", "type", "rating", "ruby_type"], :name => "company_index"', index_definition end + + def test_schema_dump_should_honor_nonstandard_primary_keys + output = standard_dump + match = output.match(%r{create_table "movies"(.*)do}) + assert_not_nil(match, "nonstandardpk table not found") + assert_match %r(:primary_key => "movieid"), match[1], "non-standard primary key not preserved" + end if current_adapter?(:MysqlAdapter) def test_schema_dump_should_not_add_default_value_for_mysql_text_field @@ -163,13 +170,6 @@ class SchemaDumperTest < ActiveRecord::TestCase assert_match %r{t.text\s+"body",\s+:null => false$}, output end - def test_mysql_schema_dump_should_honor_nonstandard_primary_keys - output = standard_dump - match = output.match(%r{create_table "movies"(.*)do}) - assert_not_nil(match, "nonstandardpk table not found") - assert_match %r(:primary_key => "movieid"), match[1], "non-standard primary key not preserved" - end - def test_schema_dump_includes_length_for_mysql_blob_and_text_fields output = standard_dump assert_match %r{t.binary\s+"tiny_blob",\s+:limit => 255$}, output |