aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migration/change_schema_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add three new rubocop rulesRafael Mendonça França2016-08-161-9/+9
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-6/+6
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-20/+20
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-28/+28
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Remove legacy mysql adapterAbdelkader Boudih2015-12-171-3/+3
|
* Internal test migrations use the private 'Current' versionMatthew Draper2015-12-151-1/+1
| | | | | | | | Apart from specific versioning support, our tests should focus on the behaviour of whatever version they're accompanying, regardless of when they were written. Application code should *not* do this.
* Deprecate `#table_exists?`, `#tables` and passing arguments to `#talbes`yui-knk2015-11-091-2/+2
| | | | | | | | | | Reported on #21509, how views is treated by `#tables` are differ by each adapters. To fix this different behavior, after Rails 5.0 is released, deprecate `#tables`. And `#table_exists?` would check both tables and views. To make their behavior consistent with `#tables`, after Rails 5.0 is released, deprecate `#table_exists?`.
* Map :bigint as NUMBER(19) sql_type by using `:limit => 19` for OracleYasuo Honda2015-06-011-1/+1
| | | | | | | | | | | | | | | | | | | since NUMBER(8) is not enough to store the maximum number of bigint. Oracle NUMBER(p,0) as handled as integer because there is no dedicated integer sql data type exist in Oracle database. Also NUMBER(p,s) precision can take up to 38. p means the number of digits, not the byte length. bigint type needs 19 digits as follows. $ irb 2.2.2 :001 > limit = 8 => 8 2.2.2 :002 > maxvalue_of_bigint = 1 << ( limit * 8 - 1) => 9223372036854775808 2.2.2 :003 > puts maxvalue_of_bigint.to_s.length 19 => nil 2.2.2 :004 >
* Closes rails/rails#18864: Renaming transactional fixtures to transactional testsBrandon Weiss2015-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I’m renaming all instances of `use_transcational_fixtures` to `use_transactional_tests` and “transactional fixtures” to “transactional tests”. I’m deprecating `use_transactional_fixtures=`. So anyone who is explicitly setting this will get a warning telling them to use `use_transactional_tests=` instead. I’m maintaining backwards compatibility—both forms will work. `use_transactional_tests` will check to see if `use_transactional_fixtures` is set and use that, otherwise it will use itself. But because `use_transactional_tests` is a class attribute (created with `class_attribute`) this requires a little bit of hoop jumping. The writer method that `class_attribute` generates defines a new reader method that return the value being set. Which means we can’t set the default of `true` using `use_transactional_tests=` as was done previously because that won’t take into account anyone using `use_transactional_fixtures`. Instead I defined the reader method manually and it checks `use_transactional_fixtures`. If it was set then it should be used, otherwise it should return the default, which is `true`. If someone uses `use_transactional_tests=` then it will overwrite the backwards-compatible method with whatever they set.
* `Type#type_cast_from_database` -> `Type#deserialize`Sean Griffin2015-02-171-2/+2
|
* Remove most type related predicates from `Column`Sean Griffin2015-01-301-2/+2
| | | | | | Remaining are `limit`, `precision`, `scale`, and `type` (the symbol version). These will remain on the column, since they mirror the options to the `column` method in the schema definition DSL
* tests, use `drop_table if_exists: true` in our test suite.Yves Senn2015-01-201-1/+1
|
* Add an `:if_exists` option to `drop_table`Stefan Kanev2015-01-191-0/+11
| | | | | | | | | | | If set to `if_exists: true`, it generates a statement like: DROP TABLE IF EXISTS posts This syntax is supported in the popular SQL servers, that is (at least) SQLite, PostgreSQL, MySQL, Oracle and MS SQL Sever. Closes #16366.
* Change the default `null` value for `timestamps` to `false`Rafael Mendonça França2015-01-041-10/+7
|
* Prefer `array?` rather than `array`Ryuta Kamizono2015-01-041-2/+2
| | | | | | Slightly refactoring `PostgreSQLColumn`. `array` should be readonly. `default_function` should be initialized by `super`. `sql_type` has been removed `[]`. Since we already choose to remove it we should not change.
* `force: :cascade` to recreate tables referenced by foreign-keys.Yves Senn2014-12-191-0/+31
|
* add table.bigint supportAaron Patterson2014-10-151-0/+19
| | | | | | | | In the DSL you can now do: create_table(:foos) do |t| t.bigint :hi end
* Change the default `null` value for timestampsSean Griffin2014-08-121-2/+5
| | | | | | | As per discussion, this changes the model generators to specify `null: false` for timestamp columns. A warning is now emitted if `timestamps` is called without a `null` option specified, so we can safely change the behavior when no option is specified in Rails 5.
* Don't type cast the default on the columnSean Griffin2014-06-171-7/+7
| | | | | | | If we want to have type decorators mess with the attribute, but not the column, we need to stop type casting on the column. Where possible, we changed the tests to test the value of `column_defaults`, which is public API. `Column#default` is not.
* fix `rake test_sqlite3_mem`.Yves Senn2014-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | While running Sqlite3 memory tests I encountered the following error: ``` Finished in 69.416366s, 58.0267 runs/s, 162.3681 assertions/s. 1) Error: ActiveRecord::Migration::ChangeSchemaTest#test_add_column_with_timestamp_type: NoMethodError: undefined method `type' for nil:NilClass /Users/senny/Projects/rails/activerecord/test/cases/migration/change_schema_test.rb:244:in `test_add_column_with_timestamp_type' 4028 runs, 11271 assertions, 0 failures, 1 errors, 1 skips ``` This was because the table `testings` was used in multiple test-cases. This resulted in a wrongly cached schema on `ActiveRecord::Base.schema_chae`. /cc @zuhao
* Remove :timestamp column typeSean Griffin2014-05-191-0/+17
| | | | | | | | | | | | The `:timestamp` type for columns is unused. All database adapters treat them as the same database type. All code in `ActiveRecord` which changes its behavior based on the column's type acts the same in both cases. However, when the type is passed to code that checks for the `:datetime` type, but not `:timestamp` (such as XML serialization), the result is unexpected behavior. Existing schema definitions will continue to work, and the `timestamp` type is transparently aliased to `datetime`.
* Remove dead test code for unsupported adaptersSean Griffin2014-05-171-10/+3
|
* Use teardown helper method.Guo Xiang Tan2014-03-141-2/+1
| | | | | | | | 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.
* make `change_column_null` reversible. Closes #13576.Yves Senn2014-01-081-0/+16
| | | | Closes #13623.
* Don't skip tests if we don't need to.Rafael Mendonça França2013-11-081-22/+14
| | | | | | | We can conditional define the tests depending on the adapter or connection. Lets keep the skip for fail tests that need to be fixed.
* Fixes #10432 add_column not creating array columns in PostgreSQLAdam Anderson2013-06-041-0/+29
| | | | | | When then PostgreSQL visitor was [added](https://github.com/rails/rails/commit/6b7fdf3bf3675a14eae74acc5241089308153a34) `add_column` was no longer receiving the column options directly. This caused the options to be lost along the way.
* Fix class and method name typosVipul A M2013-05-121-1/+1
|
* Remove extra sort from testVipul A M2013-01-211-3/+3
| | | | Cleanup change_schema tests to remove extra sorts on columns.
* Standardize the use of current_adapter?Rafael Mendonça França2013-01-011-2/+2
|
* Alias refute methods to assert_not and perfer assert_not on testsRafael Mendonça França2012-12-311-7/+7
|
* raise `ArgumentError` when redefining the primary key column. Closes #6378Yves Senn2012-10-281-0/+20
|
* Cleanup trailing whitespacesdfens2012-10-121-1/+1
|
* revert Default timestamps to non-nullDave Kroondyk2012-07-181-2/+2
| | | | | | | Commit 3dbedd2 added NOT NULL constraints to timestamps. Commit fcef728 started to revert this, but was incomplete. With this commit, 3dbedd2 should be fully reverted and timestamps will no longer default to NOT NULL.
* Add more options to column_exists? methodAleksey Magusev2012-06-301-6/+12
| | | | Also fix failures in check options for nil
* Integer limit out of range should be allowed to raise. Closes #6272Erich Menge2012-05-161-4/+0
|
* Add `create_join_table` migration helper to create HABTM join tablesRafael Mendonça França2012-01-271-1/+0
|
* move another index related test caseAaron Patterson2012-01-131-70/+0
|
* move tests regarding index modification to their own classAaron Patterson2012-01-131-84/+0
|
* decoupling more tests from AR::BaseAaron Patterson2012-01-131-0/+45
|
* move more schema modification testsAaron Patterson2012-01-131-0/+70
|
* move column ordering tests to it's own classAaron Patterson2012-01-101-46/+0
|
* refactoring migration testAaron Patterson2012-01-101-0/+414