1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

17 commits

Author SHA1 Message Date
Aaron Patterson
3e92806357 raise a better exception for renaming long indexes 2014-11-20 17:37:54 -08:00
Yves Senn
ecfce561e4 index_exists? with :name checks specified columns.
[Yves Senn & Matthew Draper]

The column check was embodied in the defaul index name.
If the :name option was used, the specified columns were not verified at all.

Given:

```
assert connection.index_exists?(table_name, :foo_id, :name => :index_testings_on_yo_momma)
```

That index could have been defined on any field, not necessarily on `:foo_id`.
2014-08-13 11:44:58 +02:00
Sean Griffin
8df8334327 Remove dead test code for unsupported adapters 2014-05-17 13:24:25 -06:00
Guo Xiang Tan
3baace687c Use teardown helper method.
Follow-Up to https://github.com/rails/rails/pull/14348

Ensure that SQLCounter.clear_log is called after each test.

This is a step to prevent side effects when running tests. This will allow us to run them in random order.
2014-03-14 20:48:59 -07:00
Rafael Mendonça França
78bac468e6 Remove more skip 2013-11-08 14:18:54 -02:00
Rafael Mendonça França
bd09afb5fb Don't skip tests if we don't need to.
We can conditional define the tests depending on the adapter or
connection.

Lets keep the skip for fail tests that need to be fixed.
2013-11-08 13:59:07 -02:00
kennyj
e185ba24c8 Remove behavior that deals with a string as third argument of add_index, because this was deprecated.
Some testcases is failed, so I replaced nil to empty hash in add_reference.
2013-06-02 08:44:31 +09:00
Rafael Mendonça França
6614471173 Fix warning 2013-02-21 00:51:39 -03:00
Yves Senn
cca43528d4 reserve index name chars for internal rails operations
Some adapter (SQLite3) need to perform renaming operations to support
the rails DDL. These rename prefixes operate with prefixes. When an
index name already uses up the full space provieded by
`index_name_length` these internal operations will fail. This patch
introduces `allowed_index_name_length` which respects the amount of
characters used for internal operations. It will always be <=
`index_name_length` and every adapter can define how many characters
need to be reserved.
2013-02-20 17:50:10 +01:00
Rafael Mendonça França
5294ad82c6 Alias refute methods to assert_not and perfer assert_not on tests 2012-12-31 13:58:52 -03:00
Rafael Mendonça França
7042fe2f84 Deprecate passing a string as third argument of add_index
This was there due historical reasons since
7dc45818dc to give the user the
possibility to create unique indexes passing "UNIQUE" as the third
argument
2012-11-02 20:03:26 -02:00
Rafael Mendonça França
8fc52706c3 Raise an ArgumentError when passing an invalid option to add_index
Closes #8104
2012-11-02 19:00:58 -02:00
Marcelo Silveira
aaffc2acd5 improved test case for partial indices 2012-02-09 19:04:07 -02:00
Marcelo Silveira
7ef22fce7c Made schema dumper recognize partial indices' where statements 2012-02-09 03:28:11 -02:00
Paul Sadauskas
6cde635f34 Handle nil in add_index :length option in MySQL
Our schema.rb is being generated with an `add_index` line similar to this:

    add_index "foo", ["foo", "bar"], :name => "xxx", :length => {"foo"=>8, "bar=>nil}

This is the same as it was on Rails 3.1.3, however, now when that
schema.rb is evaluated, its generating bad SQL in MySQL:

    Mysql::Error: You have an error in your SQL syntax; check the manual
    that corresponds to your MySQL server version for the right syntax
    to use near '))' at line 1: CREATE UNIQUE INDEX
    `xxx` ON `foo` (`foo`(8), `bar`())

This commit adds a check for nil on the length attribute to prevent the
empty parens from being output.
2012-01-24 14:22:24 -07:00
Aaron Patterson
706d8ea11a move another index related test case 2012-01-13 14:33:55 -08:00
Aaron Patterson
a394985447 move tests regarding index modification to their own class 2012-01-13 14:33:55 -08:00