File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,17 @@ class SpecificSchemaTestSqlserver < ActiveRecord::TestCase
4747 @edge_class = SqlServerEdgeSchema
4848 end
4949
50+ context 'with tinyint primary key' do
51+
52+ should 'work with identity inserts and finders' do
53+ record = SqlServerTinyintPk . new :name => '1'
54+ record . id = 1
55+ record . save!
56+ assert_equal record , SqlServerTinyintPk . find ( 1 )
57+ end
58+
59+ end
60+
5061 context 'with natural primary keys' do
5162
5263 should 'work with identity inserts' do
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ class CustomersView < ActiveRecord::Base ; self.table_name = 'customers_view' ;
4040class StringDefaultsView < ActiveRecord ::Base ; self . table_name = 'string_defaults_view' ; end
4141class StringDefaultsBigView < ActiveRecord ::Base ; self . table_name = 'string_defaults_big_view' ; end
4242class SqlServerNaturalPkData < ActiveRecord ::Base ; self . table_name = 'natural_pk_data' ; self . primary_key = 'legacy_id' ; end
43+ class SqlServerTinyintPk < ActiveRecord ::Base ; self . table_name = 'tinyint_pk_table' ; end
4344class SqlServerNaturalPkIntData < ActiveRecord ::Base ; self . table_name = 'natural_pk_int_data' ; end
4445class SqlServerNaturalPkDataSchema < ActiveRecord ::Base ; self . table_name = 'test.sql_server_schema_natural_id' ; end
4546class SqlServerQuotedTable < ActiveRecord ::Base ; self . table_name = 'quoted-table' ; end
Original file line number Diff line number Diff line change 111111 )
112112 NATURALPKINTTABLESQL
113113
114+ execute "IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'tinyint_pk_table') DROP TABLE tinyint_pk_table"
115+ execute <<-TINYITPKTABLE
116+ CREATE TABLE tinyint_pk_table(
117+ id tinyint NOT NULL PRIMARY KEY,
118+ name nvarchar(255)
119+ )
120+ TINYITPKTABLE
121+
114122 create_table 'quoted-table' , :force => true do |t |
115123 end
116124 execute "IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'quoted-view1') DROP VIEW [quoted-view1]"
You can’t perform that action at this time.
0 commit comments