Skip to content

Commit 3db259e

Browse files
committed
Test false primary non-SQL based primary dumps. Fixes #395
1 parent 114f0fd commit 3db259e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/cases/schema_dumper_test_sqlserver.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,25 @@ class SchemaDumperTestSQLServer < ActiveRecord::TestCase
100100
assert_line :binary_basic_col, type: 'binary_basic', limit: '1', precision: nil, scale: nil, default: nil
101101
assert_line :varbinary_col, type: 'varbinary', limit: '8000', precision: nil, scale: nil, default: nil
102102
assert_line :uuid_col, type: 'uuid', limit: nil, precision: nil, scale: nil, default: nil
103-
assert_line :sstimestamp_col, type: 'ss_timestamp', limit: nil, precision: nil, scale: nil, default: nil
103+
assert_line :sstimestamp_col, type: 'ss_timestamp', limit: nil, precision: nil, scale: nil, default: nil
104104
end
105105

106106
# Special Cases
107107

108-
it 'primary_key' do
108+
it 'honor nonstandard primary keys' do
109109
generate_schema_for_table('movies') do |output|
110110
match = output.match(%r{create_table "movies"(.*)do})
111111
assert_not_nil(match, "nonstandardpk table not found")
112112
assert_match %r(primary_key: "movieid"), match[1], "non-standard primary key not preserved"
113113
end
114114
end
115115

116+
it 'no id with model driven primary key' do
117+
output = generate_schema_for_table 'sst_no_pk_data'
118+
output.must_match %r{create_table "sst_no_pk_data".*id:\sfalse.*do}
119+
assert_line :name, type: 'string', limit: '4000'
120+
end
121+
116122

117123
private
118124

0 commit comments

Comments
 (0)