aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migration_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate `Migrator.schema_migrations_table_name`Ryuta Kamizono2017-03-091-0/+4
| | | | | Since 67fba0cf `SchemaMigration` model was extracted. Use `SchemaMigration.table_name` instead.
* Remove useless `Migrator.schema_migrations_table_name`Ryuta Kamizono2017-03-051-5/+5
| | | | Simply use `SchemaMigration.table_name` instead.
* Deprecate `supports_migrations?` on connection adaptersRyuta Kamizono2017-02-271-0/+4
| | | | | | | `supports_migrations?` was added at 4160b518 to determine if schema statements (`create_table`, `drop_table`, etc) are implemented in the adapter. But all tested databases has been supported migrations since a4fc93c3 at least.
* Deprecate `ColumnDumper#migration_keys`Ryuta Kamizono2017-02-071-0/+4
| | | | | | `ColumnDumper#migration_keys` was extracted to customize keys for standardized column arguments widths. But the feature was removed in df84e98. The internal method is no longer used for that.
* Deprecate `initialize_schema_migrations_table` and ↵Ryuta Kamizono2017-01-201-4/+8
| | | | | | `initialize_internal_metadata_table` These internal initialize methods are no longer used internally.
* Revert "Merge pull request #27718 from kamipo/remove_internal_public_methods"Matthew Draper2017-01-201-3/+3
| | | | | This reverts commit 39c77eb1843f79925c7195e8869afc7cb7323682, reversing changes made to 9f6f51be78f8807e18fc6562c57af2fdbf8ccb56.
* Remove `initialize_schema_migrations_table` and ↵Ryuta Kamizono2017-01-181-3/+3
| | | | | | | | | | | | `initialize_internal_metadata_table` internal public methods These internal methods accidentally appeared in the doc, and so almost useless. It is enough to create these internal tables directly, and indeed do so in several places. https://github.com/rails/rails/blob/v5.0.1/activerecord/lib/active_record/schema.rb#L55 https://github.com/rails/rails/blob/v5.0.1/activerecord/lib/active_record/railties/databases.rake#L6 https://github.com/rails/rails/blob/v5.0.1/activerecord/lib/active_record/tasks/database_tasks.rb#L230
* Fix random failure related to migration environmentPrathamesh Sonpatki2017-01-071-0/+2
| | | | | | | | | | | - Reference: https://travis-ci.org/rails/rails/jobs/189764676 - Reproduction command: MTB_VERBOSE=2 bundle exec minitest_bisect --seed 33328 -Itest "test/cases/migration_test.rb" "test/cases/tasks/database_tasks_test.rb" - You need to also add minitest_bisect gem to the Gemfile to reproduce this failure.
* Privatize unneededly protected methods in Active RecordAkira Matsuda2017-01-051-1/+1
|
* Privatize unneededly protected methods in Active Record testsAkira Matsuda2016-12-241-1/+1
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-4/+4
|
* Added nil case handling to allow rollback migration in case oftravis.h.oneill@gmail.com2016-08-171-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | invalid column type /activerecord/lib/active_record/connection_adapters /abstract/schema_definitions.rb:306 type = type.to_sym Changed to the following to handle nil case: type = type.to_sym if type Added regression test for this case: /activerecord/test/cases/migration_test.rb:554 if current_adapter?(:SQLite3Adapter) def test_allows_sqlite3_rollback_on_invalid_column_type Person.connection.create_table :something, force: true do |t| t.column :number, :integer t.column :name, :string t.column :foo, :bar end assert Person.connection.column_exists?(:something, :foo) assert_nothing_raised { Person.connection.remove_column :something, :foo, :bar } assert !Person.connection.column_exists?(:something, :foo) assert Person.connection.column_exists?(:something, :name) assert Person.connection.column_exists?(:something, :number) ensure Person.connection.drop_table :something, if_exists: true end end
* Add three new rubocop rulesRafael Mendonça França2016-08-161-6/+6
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* code gardening: removes redundant selfsXavier Noria2016-08-081-1/+1
| | | | | | | | | A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-18/+18
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-10/+10
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-35/+35
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-45/+45
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Revert "Rename `active_record_internal_metadatas` to `ar_internal_metadata`"Yasuo Honda2016-07-011-15/+0
| | | | This reverts commit 407e0ab5e5cddf6a8b6b278b12f50772d13b4d86.
* Merge pull request #24732 from y-yagi/update_record_specified_in_the_keyRafael França2016-05-211-0/+17
|\ | | | | update record specified in key
| * update record specified in keyyuuji.yaginuma2016-04-271-0/+17
| | | | | | | | | | | | `#first_or_initialize` does not use attributes to data acquisition. Therefore, there is a possibility of updating the different record than the one specified in the key, I think this is not expected behavior.
* | Support for unified Integer class in Ruby 2.4+Jeremy Daer2016-05-181-2/+2
| | | | | | | | | | | | | | | | Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005 * Forward compat with new unified Integer class in Ruby 2.4+. * Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3. * Drops needless Fixnum distinction in docs, preferring Integer.
* | Replace `Rails.version.to_f` with Active RecordJon Moss2016-04-301-0/+4
|/ | | | | Rails should not be explicity mentioned within Active Record, since railties and the Rails ecosystem is not required for use.
* Change for `ActiveRecord::Migration.[]` to raise `ArgumentError` instead of ↵yui-knk2016-03-241-0/+3
| | | | | | | | | `RuntimeError` The error is raised because user passed invalid version number to a public api of `ActiveRecord`, so `ArgumentError` is more suitable. And add a test case checking if an error is raised when unknown migration version is passed, because these test cases are not implemented.
* Ensure `drop_table` even if tests failure or interruptedRyuta Kamizono2016-02-241-7/+5
| | | | | | I was encountered remaining `:binary_testings` table by tests failure. When remaining `:binary_testings` table, never reach `drop_table` due to `create_table` in the test always fails.
* `drop_table :test_text_limits` as wellRyuta Kamizono2016-02-241-9/+13
| | | | Follow up to 3b01785.
* Merge pull request #23789 from ↵Rafael França2016-02-231-1/+1
|\ | | | | | | | | wisetara/wisetara/deprecate-args-ActiveSupport__TestCase#assert_nothing_raised-for-pr Wisetara/deprecate args active support test case#assert nothing raised for pr
| * remove args from assert_nothing_raised in testsTara Scherner de la Fuente2016-02-221-1/+1
| |
* | Make sure we don't change the global state in the testsRafael Mendonça França2016-02-231-0/+4
| | | | | | | | We are creating the table but not deleting after the test.
* | Remove needless `drop_table :test_limits`Ryuta Kamizono2016-02-231-3/+0
|/ | | | A `:test_limits` table has not been created.
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2016-02-071-2/+0
|\
| * [ci skip] Good bye SQLite2yui-knk2016-02-061-2/+0
| | | | | | | | Follow up of https://github.com/rails/rails/commit/c9feea6c9ab4494b0cb0b8cf4316847854f65af6
* | Rename `active_record_internal_metadatas` to `ar_internal_metadata`Yasuo Honda2016-02-011-0/+15
| | | | | | | | for those who already migrated to Rails 5.0.0 beta
* | Shorten ActiveRecord::InternalMetadata.table_name to ar_internal_metadataYasuo Honda2016-02-011-5/+5
|/ | | | to support Oracle database which only supports 30 byte identifier length
* Fix intermittent test failuresschneems2016-01-141-0/+1
| | | 😳
* Revert "Revert "Set environment even when no migration runs""schneems2016-01-141-1/+28
| | | | This reverts commit 11e85b91731ca6125ee1db33553f984549a3bc2b.
* Revert "Set environment even when no migration runs"Sean Griffin2016-01-141-28/+1
|
* Set environment even when no migration runsschneems2016-01-111-0/+27
| | | | | This PR addresses the issue described in https://github.com/rails/rails/pull/22967#issuecomment-170251635. If the database is non empty and has no new migrations than `db:migrate` will not set the environment. This PR works by always setting the environment value on successful `up` migration regardless of whether or not a migration was actually executed.
* Clean up duplicate migration logicschneems2016-01-111-1/+1
|
* Merge pull request #22967 from schneems/schneems/generic-metadataSean Griffin2016-01-081-0/+44
|\ | | | | Prevent destructive action on production database
| * Use hash like syntax for InternalMetadataschneems2016-01-081-2/+2
| | | | | | | | Discussion: https://github.com/rails/rails/pull/22967#discussion_r49137035
| * Prevent destructive action on production databaseschneems2016-01-071-0/+44
| | | | | | | | | | | | | | This PR introduces a key/value type store to Active Record that can be used for storing internal values. It is an alternative implementation to #21237 cc @sgrif @matthewd. It is possible to run your tests against your production database by accident right now. While infrequently, but as an anecdotal data point, Heroku receives a non-trivial number of requests for a database restore due to this happening. In these cases the loss can be large. To prevent against running tests against production we can store the "environment" version that was used when migrating the database in a new internal table. Before executing tests we can see if the database is a listed in `protected_environments` and abort. There is a manual escape valve to force this check from happening with environment variable `DISABLE_DATABASE_ENVIRONMENT_CHECK=1`.
* | Remove legacy mysql adapterAbdelkader Boudih2015-12-171-1/+1
| |
* | Don't over-specify types in our testsSean Griffin2015-12-161-1/+0
|/ | | | | | | This test was failing when run on Windows using PostgreSQL. Depending on the OS (and 32 vs 64 bit), this type could be a `BigNum`. We could loosen the assertion to `Numeric`, but if the value is equal to the expected, and responds to `bitlength` properly, who cares?
* Internal test migrations use the private 'Current' versionMatthew Draper2015-12-151-10/+10
| | | | | | | | 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.
* Revert "Allow specifying the default table options for mysql adapters"Sean Griffin2015-11-191-19/+0
| | | | | | | This reverts commit 8246b593bff71f2cebf274c133bb8917f1e094c8. There was concern about this modifying the behavior of past migrations. We're going to add an way to modify the migration generator instead.
* Allow specifying the default table options for mysql adaptersSean Griffin2015-11-191-0/+19
| | | | | | | | | | | | | It's often the case that you want to have an option that you cannot specify at the database level, but want applied to *all* tables that you create. For example, you might want to specify `ROW_FORMAT=DYNAMIC` to not have to limit text columns to length 171 for indexing when using utf8mb4. This allows an easy way to specify this in your database configuration. While this change affects both MySQL and MySQL2, the test only covers MySQL2, as the legacy mysql adapter appears to always return ASCII strings, and is tangential to what we're actually doing.
* Rename 'key' to 'lock_id' or 'lock_name' for advisory lockingSam Davies2015-11-181-19/+19
| | | | | | | | | - key was a poor choice of name. A key implies something that will unlock a lock. The concept is actually more like a 'lock identifier' - mysql documentation calls this a 'lock name' - postgres documentation calls it a 'lock_id' - Updated variable names to reflect the preferred terminology for the database in question
* Require the count_down_latchRafael Mendonça França2015-11-051-2/+3
|