@@ -257,71 +257,68 @@ def test_add_index
257
257
connection . add_index ( "testings" , %w( last_name first_name administrator ) , name : "named_admin" )
258
258
connection . remove_index ( "testings" , name : "named_admin" )
259
259
260
- # Selected adapters support index sort order
261
- if current_adapter? ( :SQLite3Adapter , :Mysql2Adapter , :TrilogyAdapter , :PostgreSQLAdapter )
262
- connection . add_index ( "testings" , [ "last_name" ] , order : { last_name : :desc } )
263
- connection . remove_index ( "testings" , [ "last_name" ] )
264
- connection . add_index ( "testings" , [ "last_name" , "first_name" ] , order : { last_name : :desc } )
265
- connection . remove_index ( "testings" , [ "last_name" , "first_name" ] )
266
- connection . add_index ( "testings" , [ "last_name" , "first_name" ] , order : { last_name : :desc , first_name : :asc } )
267
- connection . remove_index ( "testings" , [ "last_name" , "first_name" ] )
268
- connection . add_index ( "testings" , [ "last_name" , "first_name" ] , order : :desc )
269
- connection . remove_index ( "testings" , [ "last_name" , "first_name" ] )
270
- end
260
+ connection . add_index ( "testings" , [ "last_name" ] , order : { last_name : :desc } )
261
+ connection . remove_index ( "testings" , [ "last_name" ] )
262
+ connection . add_index ( "testings" , [ "last_name" , "first_name" ] , order : { last_name : :desc } )
263
+ connection . remove_index ( "testings" , [ "last_name" , "first_name" ] )
264
+ connection . add_index ( "testings" , [ "last_name" , "first_name" ] , order : { last_name : :desc , first_name : :asc } )
265
+ connection . remove_index ( "testings" , [ "last_name" , "first_name" ] )
266
+ connection . add_index ( "testings" , [ "last_name" , "first_name" ] , order : :desc )
267
+ connection . remove_index ( "testings" , [ "last_name" , "first_name" ] )
271
268
end
272
269
273
- if current_adapter? ( :PostgreSQLAdapter )
274
- def test_add_partial_index
275
- connection . add_index ( "testings" , "last_name" , where : "first_name = 'john doe'" )
276
- assert connection . index_exists? ( "testings" , "last_name" )
270
+ def test_add_partial_index
271
+ skip ( "current adapter doesn't support partial indexes" ) unless supports_partial_index?
277
272
278
- connection . remove_index ( "testings" , "last_name" )
279
- assert_not connection . index_exists? ( "testings" , "last_name" )
280
- end
273
+ connection . add_index ( "testings" , "last_name" , where : "first_name = 'john doe'" )
274
+ assert connection . index_exists? ( "testings" , "last_name" )
281
275
282
- def test_add_index_with_included_column
283
- skip ( "current adapter doesn't support include indexes" ) unless supports_index_include?
276
+ connection . remove_index ( "testings" , "last_name" )
277
+ assert_not connection . index_exists? ( "testings" , "last_name" )
278
+ end
284
279
285
- connection . add_index ( "testings" , "last_name" , include : :foo )
286
- assert connection . index_exists? ( "testings" , "last_name" , include : :foo )
280
+ def test_add_index_with_included_column
281
+ skip ( "current adapter doesn't support include indexes" ) unless supports_index_include?
287
282
288
- connection . remove_index ( "testings" , "last_name" )
289
- assert_not connection . index_exists? ( "testings" , "last_name" )
290
- end
283
+ connection . add_index ( "testings" , "last_name" , include : :foo )
284
+ assert connection . index_exists? ( "testings" , "last_name" , include : :foo )
291
285
292
- def test_add_index_with_multiple_included_columns
293
- skip ( "current adapter doesn't support include indexes" ) unless supports_index_include?
286
+ connection . remove_index ( "testings" , "last_name" )
287
+ assert_not connection . index_exists? ( "testings" , "last_name" )
288
+ end
294
289
295
- connection . add_index ( "testings" , "last_name" , include : [ :foo , :bar ] )
296
- assert connection . index_exists? ( "testings" , "last_name" , include : [ :foo , :bar ] )
290
+ def test_add_index_with_multiple_included_columns
291
+ skip ( "current adapter doesn't support include indexes" ) unless supports_index_include?
297
292
298
- connection . remove_index ( "testings" , "last_name" )
299
- assert_not connection . index_exists? ( "testings" , "last_name" )
300
- end
293
+ connection . add_index ( "testings" , "last_name" , include : [ :foo , :bar ] )
294
+ assert connection . index_exists? ( "testings" , "last_name" , include : [ :foo , :bar ] )
301
295
302
- def test_add_index_with_included_column_and_where_clause
303
- skip ( "current adapter doesn't support include indexes" ) unless supports_index_include?
296
+ connection . remove_index ( "testings" , "last_name" )
297
+ assert_not connection . index_exists? ( "testings" , "last_name" )
298
+ end
304
299
305
- connection . add_index ( "testings" , "last_name" , include : :foo , where : "first_name = 'john doe'" )
306
- assert connection . index_exists? ( "testings" , "last_name" , include : :foo , where : "first_name = 'john doe'" )
300
+ def test_add_index_with_included_column_and_where_clause
301
+ skip ( "current adapter doesn't support include indexes" ) unless supports_index_include?
307
302
308
- connection . remove_index ( "testings" , "last_name" )
309
- assert_not connection . index_exists? ( "testings" , "last_name" , include : :foo , where : "first_name = 'john doe'" )
310
- end
303
+ connection . add_index ( "testings" , "last_name" , include : :foo , where : "first_name = 'john doe'" )
304
+ assert connection . index_exists? ( "testings" , "last_name" , include : :foo , where : "first_name = 'john doe'" )
311
305
312
- def test_add_index_with_nulls_not_distinct_assert_exists_with_same_values
313
- skip ( "current adapter doesn't support nulls not distinct" ) unless supports_nulls_not_distinct?
306
+ connection . remove_index ( "testings" , "last_name" )
307
+ assert_not connection . index_exists? ( "testings" , "last_name" , include : :foo , where : "first_name = 'john doe'" )
308
+ end
314
309
315
- connection . add_index ( "testings" , "last_name" , nulls_not_distinct : true )
316
- assert connection . index_exists? ( "testings" , "last_name" , nulls_not_distinct : true )
317
- end
310
+ def test_add_index_with_nulls_not_distinct_assert_exists_with_same_values
311
+ skip ( "current adapter doesn't support nulls not distinct" ) unless supports_nulls_not_distinct?
318
312
319
- def test_add_index_with_nulls_not_distinct_assert_exists_with_different_values
320
- skip ( "current adapter doesn't support nulls not distinct" ) unless supports_nulls_not_distinct?
313
+ connection . add_index ( "testings" , "last_name" , nulls_not_distinct : true )
314
+ assert connection . index_exists? ( "testings" , "last_name" , nulls_not_distinct : true )
315
+ end
321
316
322
- connection . add_index ( "testings" , "last_name" , nulls_not_distinct : false )
323
- assert_not connection . index_exists? ( "testings" , "last_name" , nulls_not_distinct : true )
324
- end
317
+ def test_add_index_with_nulls_not_distinct_assert_exists_with_different_values
318
+ skip ( "current adapter doesn't support nulls not distinct" ) unless supports_nulls_not_distinct?
319
+
320
+ connection . add_index ( "testings" , "last_name" , nulls_not_distinct : false )
321
+ assert_not connection . index_exists? ( "testings" , "last_name" , nulls_not_distinct : true )
325
322
end
326
323
327
324
private
0 commit comments