| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
to support Oracle database which only supports 30 byte identifier length
|
|
|
|
|
|
| |
everywhere(the default behaviour now) instead of mix of /bin/rake /bin/rails everywhere
[Ryo Hashimoto & Vipul A M]
|
| |
|
|
|
|
|
|
|
| |
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`.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`1_valid_people_have_last_names.rb` and
`20150823202140_create_users.rb` are valid migration file name.
But `1_valid_people_have_last_names.rb` is rendered as
`********** NO FILE **********` when `rake db:migrate:status`.
Fix to this bug, this commit includes
* define some API private methdos and a Constant
`match_to_migration_filename?`, `parse_migration_filename`, and
`MigrationFilenameRegexp`
* use these methods in `db:migrate:status` task
Example:
These files are in `db/migrate`
* 1_valid_people_have_last_names.rb
* 20150819202140_irreversible_migration.rb
* 20150823202140_add_admin_flag_to_users.rb
* 20150823202141_migration_tests.rb
* 2_we_need_reminders.rb
* 3_innocent_jointable.rb
we can migrate all of them.
Before
```shell
$ bundle exec rake db:migrate:status
...
Status Migration ID Migration Name
--------------------------------------------------
up 001 ********** NO FILE **********
up 002 ********** NO FILE **********
up 003 ********** NO FILE **********
up 20150819202140 Irreversible migration
up 20150823202140 Add admin flag to users
up 20150823202141 Migration tests
```
After
```shell
$ bundle exec rake db:migrate:status
...
Status Migration ID Migration Name
--------------------------------------------------
up 001 Valid people have last names
up 002 We need reminders
up 003 Innocent jointable
up 20150819202140 Irreversible migration
up 20150823202140 Add admin flag to users
up 20150823202141 Migration tests
```
|
|
|
|
|
|
|
|
|
|
|
| |
* If the drop task fails for a reason other than the database not
existing, processing should end. This is indicated by a non-zero
exit status.
* Since the backtrace is already printed to screen, we forgo
printing it again by using an explicit call to `exit`.
* :warning: This modifies the behavior of the db:create task slightly in
that the stack trace is no longer printed by default. If the `--trace`
option is used, it will print the trace _after_ the error message.
|
|
|
|
|
|
|
|
|
|
|
| |
* If the create task fails for a reason other than the database already
existing, processing should end. This is indicated by a non-zero exit
status.
* Since the backtrace is already printed to screen, we forgo printing it
again by using an explicit call to `exit`.
* :warning: This modifies the behavior of the db:create task slightly in
that the stack trace is no longer printed by default. If the `--trace`
option is used, it will print the trace _after_ the error message.
|
|
|
|
|
|
|
| |
* Previously the sqlite3 adapter could not "fail" on drop. Now an error
is raised when no file exists.
* Also updates purge to be resilient of drop failures. This is how purge
is expected to behave.
|
|
|
|
|
|
|
|
|
|
| |
* Running the db:create task when the database already exists isn't
really an error case. That is processing may proceed in this case
because the database exists as requested. So let's validate that
behavior with a test.
* Likewise, if the database doesn't exist when running the db:drop task
processing may continue as the requested condition is already met.
Thus a test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Taken from @Sonopa's commits on PR #19091.
Add support for dev caching via "rails s" flags.
Implement suggestions from @kaspth.
Remove temporary cache file if server does not have flags.
Break at 80 characters in railties/CHANGELOG.md
Remove ability to disable cache based on server options.
Add more comprehensive options: --dev-caching / --no-dev-caching
|
|
|
|
|
|
|
|
|
|
|
| |
Presumably due to https://github.com/rails/sprockets-rails/pull/265 sprockets was trying to load the "scss" gem but it isn't in the gemfile:
```
ApplicationTests::RakeTests::RakeNotesTest#test_register_a_new_extension:
LoadError: cannot load such file -- sass
```
If we use an empty precompile list, it won't try to load sass.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Closes #20743.
The task `db:_dump` now only dumps the schema if
`ActiveRecord::Base.dump_schema_after_migration` is true. This has
effects:
- `db:migrate:up`
- `db:migrate:down`
- `db:forward`
- `db:rollback`
|
|
|
|
|
| |
We recommend using the `bin/` executables in our docs and guides.
Let's make sure that our tests execute the same code path.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In restart.rake, the creation of tmp/restart.txt
would fail if the tmp folder does not exist in the
app. This is a problem because apps cloned using
git would not have the tmp folder, as the folder is
in .gitignore. This commit creates the tmp folder
if it does not exist.
Fixes #20299
[Yoong Kang Lim, Sunny Juneja]
|
|\
| |
| |
| | |
Fix rake method definition leaking onto Object
|
|/
|
|
|
|
| |
add framework_test
add another test
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
calebthompson/dont-rely-on-environment-task-for-schema-load"
This reverts commit 08ff4ccbbb3fb143a02e6752efb974a4bcfcd3bb, reversing
changes made to 6c9ed6dbc62450cdb87559afd15798305e069146.
Caused by #17920.
Closes #19545.
This patch introduced regressions because initializers were no longer
loaded. Specifically missing inflections result in broken restores of
the database.
|
|
|
|
|
|
|
| |
Preserving RACK_ENV behavior.
This reverts commit 7bdc7635b885e473f6a577264fd8efad1c02174f, reversing
changes made to 45786be516e13d55a1fca9a4abaddd5781209103.
|
| |
|
|
|
|
|
|
| |
Fixes #18876. Rake restart touches `tmp/restart.txt` to restart
application on next request. Updated tests and documentation
accordingly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Closes #17945
`db:test:prepare` still purges the database to always keep the test
database in a consistent state.
This patch introduces new problems with `db:schema:load`. Prior
to the introduction of foreign-keys, we could run this file against
a non-empty database. Since every `create_table` containted the
`force: true` option, this would recreate tables when loading the schema.
However with foreign-keys in place, `force: true` wont work anymore and
the task will crash.
/cc @schneems
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts deprecations added in #13528.
The task is brought back for two reasons:
1. Give plugins a way to hook into the test database initialization process
2. Give the user a way to force a test database synchronization
While `test:prepare` is still a dependency of every test task, `db:test:prepare`
no longer hooks into it. This means that `test:prepare` runs before the schema
is synchronized. Plugins, which insert data can now hook into `db:test:prepare`.
The automatic schema maintenance can't detect when a migration is rolled-back,
modified and reapplied. In this case the user has to fall back to `db:test:prepare`
to force the synchronization to happen.
|
|
|
|
|
|
|
|
| |
db:fixtures:load"
This reverts commit 482fdad5ef8a73688b50bba3991dd4ef6f286edd.
Fixes #17237.
|
|
|
|
|
| |
This is a follow-up to ded17a4 to get the build passing on Travis.
As Travis has `ENV["RACK_ENV"]` set to `test` we need to reset that as well.
|
|
|
|
|
|
|
|
|
|
| |
[Joshua Cody & Yves Senn]
Closes #16757.
Prior to this patch schema loading rake tasks had the potential to leak a
connection to a different database. This had side-effects when rake tasks
operating on the current connection (like `db:seed`) were chained.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Restore the 4.0 behaviour for 'sqlite3:///', but deprecate it. We'll
change to the absolute-path interpretation in 4.2.
The current "correct" spellings for in-memory, relative, and absolute
URLs, respectively, are:
sqlite3::memory:
sqlite3:relative/path
sqlite3:/full/path
Substantially reverses/defers fbb79b517f3127ba620fedd01849f9628b78d6ce.
Uncovered by @guilleiguaran while investigating #14495, though that
sounds like a different issue.
|
|
|
|
| |
This is a test case for the fix provided in eafec4694c5b37eff9d83b1188b8e331fa6027fa
|
|
|
|
|
| |
Just pass in the expected database as argument rather than "caching"
it in a hash and using the hash in the helper methods.
|
|
|
|
| |
Also fix indent of test block.
|
| |
|
| |
|
|
|
|
| |
Refactor to a reusable method.
|
|
|
|
|
| |
No need to check that each line contains an extra space, just matching
the space in the regexp is enough to ensure that.
|
| |
|
|\
| |
| | |
Add Public Api for Register New Extensions for Rake Notes
|
| |
| |
| |
| | |
config/application.rb file
|
| | |
|
| | |
|
| |
| |
| |
| | |
have an API for register it in the corresponding gems
|
| | |
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Squashed commit of the following:
commit 96991e8e919edfb20cc4120bca4e36ed51175d57
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri Feb 14 11:29:24 2014 -0800
Revert "gems can be added or skipped from the template"
This reverts commit 8beb42cfbc41753ae4dbb91e16abcd1fb7d00356.
Conflicts:
railties/lib/rails/generators/rails/app/app_generator.rb
railties/test/generators/app_generator_test.rb
commit 35599c0e657245ef14ac0f28c9189ad16acf40e6
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri Feb 14 11:26:53 2014 -0800
Revert "oops, template replay needs to happen after bundle. :orz:"
This reverts commit 9104702be61253f9448ca070a22fc86bb4299555.
Conflicts:
railties/lib/rails/generators/rails/app/app_generator.rb
commit f519c3902c313db8e906a49251c91643b8e6499e
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri Feb 14 11:25:51 2014 -0800
Revert "only ask for these ivars if the target responds to them"
This reverts commit 656d412546cd97d5660c634c2a41c799d3f9e211.
commit aa524a9428e3e4c45fe221f10a66a08efb827ab5
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri Feb 14 11:25:39 2014 -0800
Revert "refactor generator tests to use block form of Tempfile"
This reverts commit 65251820ef0ab7f3cffb38130de3dd41af8d72be.
commit 7d3740549fa4dfa62e3761f8d4bc6d6d441256e7
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri Feb 14 11:25:25 2014 -0800
Revert "add a more restricted codepath for templates fixes #13390"
This reverts commit 2875b4a66e38e4333da887a4afbed33358999298.
commit 525df0af1001918986cdfce59539fd2d52c4f32c
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri Feb 14 11:25:11 2014 -0800
Revert "add a send so `apply` can be called. Fixes #13510"
This reverts commit c5034d60dba0cd31a6a8c612ee35d63b8127793a.
|
|
|
|
|
|
|
| |
THIS IS A HUGE HACK. Thor does not allow us to define public methods
without turning them in to "thor tasks". That means we cannot subclass
the `apply` method and make it public, so we have to make the method
private and call `send` on it.
|
|
|
|
|
|
|
|
|
| |
* Add a config on Active Record named `dump_schema_after_migration`
* Schema dump doesn't happen if the config is set to false
* Set default value of the config to true
* Set config in generated production environment file to false
* Update configuration guide
* Update CHANGELOG
|