File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,11 @@ class SpecificSchemaTestSqlserver < ActiveRecord::TestCase
6262 assert record . save
6363 assert_equal 12 , record . reload . id
6464 end
65+
66+ should 'use primary key for row table order in pagination sql' do
67+ sql = /OVER \( ORDER BY \[ natural_pk_data\] \. \[ legacy_id\] ASC\) /
68+ assert_sql ( sql ) { SqlServerNaturalPkData . limit ( 5 ) . offset ( 5 ) . all }
69+ end
6570
6671 end
6772
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class FloatData < ActiveRecord::Base ; self.table_name = 'float_data' ; end
3939class CustomersView < ActiveRecord ::Base ; self . table_name = 'customers_view' ; end
4040class StringDefaultsView < ActiveRecord ::Base ; self . table_name = 'string_defaults_view' ; end
4141class StringDefaultsBigView < ActiveRecord ::Base ; self . table_name = 'string_defaults_big_view' ; end
42- class SqlServerNaturalPkData < ActiveRecord ::Base ; self . table_name = 'natural_pk_data' ; end
42+ class SqlServerNaturalPkData < ActiveRecord ::Base ; self . table_name = 'natural_pk_data' ; self . primary_key = 'legacy_id' ; end
4343class SqlServerNaturalPkIntData < ActiveRecord ::Base ; self . table_name = 'natural_pk_int_data' ; end
4444class SqlServerNaturalPkDataSchema < ActiveRecord ::Base ; self . table_name = 'test.sql_server_schema_natural_id' ; end
4545class SqlServerQuotedTable < ActiveRecord ::Base ; self . table_name = 'quoted-table' ; end
You can’t perform that action at this time.
0 commit comments